Skip to content

Commit 370c729

Browse files
authored
Merge pull request #1041 from gplanchat/docs/magento-public-promise
docs(magento): describe the database backend where Magento was memory or Temporal only (#739, #1036)
2 parents 18e397e + 1c96267 commit 370c729

9 files changed

Lines changed: 89 additions & 36 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ It runs on Symfony, Sylius, Laravel, Magento 2.4 and Mage-OS. On Symfony and Lar
1414
through Messenger or the application's queue; on Magento, through `bin/magento durable:worker`. The
1515
same workflow code runs on three backends (where the journal lives): in memory (tests), on one SQL
1616
database (Doctrine DBAL or Laravel's database layer), or on a Temporal cluster. To switch, you install
17-
that backend's bridge and change one configuration value. Magento offers memory and Temporal only.
17+
that backend's bridge and change one configuration value. Magento has its own
18+
database backend instead of the two SQL bridges, see [Backends](documentation/user/backends/_index.md).
1819

1920
## Example: a workflow that waits three days
2021

@@ -98,7 +99,7 @@ This monorepo holds every package. A split publishes each one to its own read-on
9899
| `gplanchat/durable-bridge-illuminate` | [`src/Bridge/Illuminate/`](src/Bridge/Illuminate/) | Illuminate (Laravel) journal and stores: durable execution on one SQL database through Laravel's database layer (**DUR030**) |
99100
| `gplanchat/durable-laravel` | [`src/DurableLaravel/`](src/DurableLaravel/) | Laravel integration: binds the four storage ports from one published config file, work rides the application's queue |
100101
| `gplanchat/durable-filament` | [`src/DurableFilament/`](src/DurableFilament/) | Filament 3 and 4 panel plugin: read-only dashboard of workflow runs, requires the Laravel integration |
101-
| `gplanchat/durable-magento` | [`src/DurableModule/`](src/DurableModule/) | Magento 2 / Mage-OS module: `durable:worker`, a read-only admin grid and process history, memory and Temporal backends (**DUR046**) |
102+
| `gplanchat/durable-magento` | [`src/DurableModule/`](src/DurableModule/) | Magento 2 / Mage-OS module: `durable:worker`, a read-only admin grid and process history, memory, database and Temporal backends (**DUR046**, **DUR056**) |
102103
| `gplanchat/durable-plugin` | [`src/DurablePlugin/`](src/DurablePlugin/) | Sylius 2 admin plugin: workflow dashboard, backend-neutral (**DUR037**) |
103104
| `gplanchat/durable-phpstan` | [`src/DurablePhpstan/`](src/DurablePhpstan/) | PHPStan extension: resolves stub calls against their typed contract |
104105
| `gplanchat/durable-rector` | [`src/DurableRector/`](src/DurableRector/) | Rector rules migrating a project off the official Temporal PHP SDK |

‎UPGRADE.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,23 @@ class-not-found error.
13751375
The Temporal SDK class `Temporal\Workflow\Saga` is unchanged, and the migration set from the SDK
13761376
still reports it as unmigratable.
13771377

1378+
### Changed: Magento reaches a third backend, its own database (#739)
1379+
1380+
`gplanchat/durable-magento` now has a database backend (DUR056) next to memory and Temporal. It
1381+
uses neither SQL bridge: the `conflict` on `gplanchat/durable-bridge-dbal` and
1382+
`gplanchat/durable-bridge-illuminate` stays.
1383+
1384+
**Who is affected**: Magento stores that declare `resource/durable` in `app/etc/env.php`, or
1385+
that add the key later. A store that sets neither it nor `durable/temporal/dsn` keeps its journal
1386+
in the process, and one with only a DSN keeps Temporal. Declaring both keys throws
1387+
`BackendSelectionException` the first time the module resolves its journal
1388+
(`RuntimeFactory::backend()`, `JournalConnectionResolver::connect()`).
1389+
1390+
**What to do**: nothing, unless you want the database backend. Then declare a dedicated
1391+
`db/connection/durable`, set `resource/durable` to `['connection' => 'durable']`, and run
1392+
`bin/magento durable:setup` and `bin/magento durable:worker`. The
1393+
[backends page](documentation/user/backends/_index.md) lists what the database backend supports.
1394+
13781395
## 0.1.0-beta1
13791396

13801397
### A failed retry enqueue is sent again; journals gain `ActivityRetryQueued` (#590)

‎documentation/user/concepts/_index.fr.md‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,13 @@ Durable tourne sur quatre backends qui partagent le même code de workflows et d
345345
- Nécessite l'extension PHP `ext-grpc`.
346346

347347
> [!NOTE]
348-
> **Sur Magento, deux des quatre seulement sont atteignables.** `gplanchat/durable-magento` déclare
349-
> un `conflict` Composer sur les deux ponts SQL : `Magento\Framework\App\ResourceConnection` n'est
350-
> ni Doctrine DBAL ni la connexion d'Illuminate, aucun des deux n'a donc de quoi se brancher. L'état
351-
> vit dans un cluster Temporal, ou il vit dans un processus, et c'est la présence de
352-
> `durable/temporal/dsn` dans `app/etc/env.php` qui tranche.
348+
> **Sur Magento, trois états sont possibles, et aucun n'utilise les ponts SQL.**
349+
> `gplanchat/durable-magento` déclare un `conflict` Composer sur les deux ponts :
350+
> `Magento\Framework\App\ResourceConnection` n'est ni Doctrine DBAL ni la connexion d'Illuminate. Son
351+
> backend base de données est un adaptateur à lui, sur la connexion que `resource/durable` désigne
352+
> dans `app/etc/env.php`. Un DSN dans `durable/temporal/dsn` sélectionne Temporal. Sans l'un ni
353+
> l'autre, le journal vit dans un processus. Déclarer les deux échoue au démarrage avec
354+
> `BackendSelectionException`.
353355
354356
Pour la mise en place, voir [Backends](../backends/).
355357

@@ -371,8 +373,9 @@ worker.
371373

372374
**Magento** ne se sert ni de l'un ni de l'autre. Les workers sont des commandes
373375
`bin/magento durable:worker --role=journal|activity` qui interrogent le backend directement ; rien ne
374-
passe par le `MessageQueue` de Magento, parce que sur Temporal une activité est déjà une commande
375-
Temporal et une reprise une tâche de workflow.
376+
passe par le `MessageQueue` de Magento. Sur Temporal, une activité est déjà une commande Temporal
377+
et une reprise une tâche de workflow. Sur le backend base de données, les workers interrogent les files
378+
en tables de la connexion du journal.
376379

377380
### Une reprise est livrée au moins une fois
378381

‎documentation/user/concepts/_index.md‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,12 @@ Durable runs on four backends that share the same workflow and activity code:
355355
- Requires the `ext-grpc` PHP extension.
356356

357357
> [!NOTE]
358-
> **On Magento, only two of the four are reachable.** `gplanchat/durable-magento` declares a Composer
359-
> `conflict` on both SQL bridges: `Magento\Framework\App\ResourceConnection` is neither Doctrine
360-
> DBAL nor Illuminate's connection, so neither has anything to bind to. The state lives in a Temporal
361-
> cluster, or it lives in one process, and the presence of `durable/temporal/dsn` in `app/etc/env.php`
362-
> decides which.
358+
> **On Magento, three states are possible, and none uses the SQL bridges.** `gplanchat/durable-magento`
359+
> declares a Composer `conflict` on both bridges: `Magento\Framework\App\ResourceConnection` is neither
360+
> Doctrine DBAL nor Illuminate's connection. Its database backend is its own adapter, on the
361+
> connection that `resource/durable` names in `app/etc/env.php`. A DSN in `durable/temporal/dsn`
362+
> selects Temporal. With neither, the journal lives in one process. Declaring both fails at boot with
363+
> `BackendSelectionException`.
363364
364365
For setup details, see [Backends](../backends/).
365366

@@ -379,8 +380,9 @@ the same consumer interface, a different underlying protocol.
379380
is a deferred timer-firing job on the queue's own delay, and `php artisan queue:work` is the only worker.
380381

381382
**Magento** uses neither. Workers are `bin/magento durable:worker --role=journal|activity` commands
382-
that poll the backend directly; nothing rides Magento's own `MessageQueue`, because on Temporal an
383-
activity is already a Temporal command and a resume a workflow task.
383+
that poll the backend directly; nothing rides Magento's own `MessageQueue`. On Temporal, an
384+
activity is already a Temporal command and a resume a workflow task. On the database backend, the
385+
workers poll the table queues of the journal's connection.
384386

385387
### A resume is delivered at least once
386388

‎documentation/user/configuration/_index.fr.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,6 @@ de données. Les lignes DBAL et Illuminate ne s'y appliquent pas.
443443

444444
## Voir aussi
445445

446-
- [Backends](../backends/) compare la mémoire et Temporal : mise en place Docker, workers, paramètres du DSN.
446+
- [Backends](../backends/) compare les backends mémoire, SQL et Temporal : mise en place Docker, workers, paramètres du DSN.
447447
- [Premiers pas](../getting-started/) couvre la configuration du routage Messenger.
448448
- [Tester des workflows](../testing/) couvre `DurableBundleTestTrait` et la configuration de test en mémoire.

‎documentation/user/configuration/_index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,6 @@ rows do not apply there.
435435

436436
## See also
437437

438-
- [Backends](../backends/) compares In-Memory and Temporal: Docker setup, workers, DSN parameters.
438+
- [Backends](../backends/) compares the in-memory, SQL and Temporal backends: Docker setup, workers, DSN parameters.
439439
- [Getting started](../getting-started/) covers Messenger routing configuration.
440440
- [Testing workflows](../testing/) covers `DurableBundleTestTrait` and in-memory test configuration.

‎documentation/user/dashboard/run-not-progressing.fr.md‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,21 @@ tableau de bord nomme chaque rôle dont la file n'est interrogée par aucun work
4747
`bin/console durable:health` sort avec un code non nul quand la file d'un rôle n'a été interrogée
4848
par personne depuis deux minutes, et nomme le `durable:worker --role` à démarrer.
4949

50+
## Aucun worker ne vide les tables du backend base de données de Magento
51+
52+
Rien n'échoue : l'exécution reste en file dans les tables du journal. La grille Magento affiche
53+
`waiting for a worker` pour une exécution en cours qu'aucun worker n'a prise, à partir de la colonne
54+
`picked_up_at` de la table des exécutions. Le backend base de données n'a que les rôles
55+
journal et activité : démarrez `bin/magento durable:worker --role=journal` et `--role=activity`, ou
56+
lancez-le sans `--role` pour vider les deux. `durable:health` vérifie seulement que la base du
57+
journal répond ; la grille montre une exécution qui attend un worker.
58+
5059
## `waiting for a worker` n'apparaît jamais
5160

52-
Le backend n'a pas cette information. Les backends SQL l'ont, sur une table des exécutions qui a la
53-
colonne `picked_up_at` (voir [la procédure de mise à jour](https://github.com/gplanchat/durable-dev/blob/main/UPGRADE.md)
54-
pour une table créée avant elle). Temporal ne l'a pas depuis la liste des exécutions, et la grille
55-
Magento ne l'affiche pas : Temporal UI liste les tâches en attente.
61+
Le backend n'a pas cette information. Les backends SQL et le backend base de données de Magento l'ont, sur une table des exécutions
62+
qui a la colonne `picked_up_at` (voir [la procédure de mise à jour](https://github.com/gplanchat/durable-dev/blob/main/UPGRADE.md)
63+
pour une table créée avant elle). Temporal ne l'a pas depuis la liste des exécutions, aucune grille
64+
ne l'affiche donc : Temporal UI liste les tâches en attente.
5665

5766
## Les filtres par nom et par identifiant manquent
5867

‎documentation/user/dashboard/run-not-progressing.md‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,20 @@ dashboard names each role whose queue has no poller. From a shell, `bin/console
4444
exits non-zero when a role's queue has gone two minutes without a poll, and names the
4545
`durable:worker --role` to start.
4646

47+
## No worker is draining the tables on the Magento database backend
48+
49+
Nothing fails: the run stays queued in the journal's tables. The Magento grid shows `waiting for a
50+
worker` for a running execution that no worker has picked up, from the `picked_up_at` column of the
51+
runs table. The database backend has the journal and activity roles only: start
52+
`bin/magento durable:worker --role=journal` and `--role=activity`, or run it without `--role` to
53+
drain both. `durable:health` only checks that the journal database answers; the grid shows a run
54+
that waits for a worker.
55+
4756
## `waiting for a worker` never appears
4857

49-
The backend records no pickup time. The SQL backends record it, on a runs table that has the `picked_up_at` column
50-
(see [Upgrading](https://github.com/gplanchat/durable-dev/blob/main/UPGRADE.md) for a table created
51-
before it existed). Temporal records none the run list can read, and the Magento grid does not show it:
58+
The backend records no pickup time. The SQL backends and the Magento database backend record it,
59+
on a runs table that has the `picked_up_at` column (see [Upgrading](https://github.com/gplanchat/durable-dev/blob/main/UPGRADE.md) for a table created
60+
before it existed). Temporal records none the run list can read, so no grid shows it there:
5261
Temporal UI lists the pending tasks.
5362

5463
## The name and id filters are missing

‎src/DurableModule/README.md‎

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,34 @@ Magento Open Source and Adobe Commerce are not in CI: their packages come from
4848
`repo.magento.com`, which needs credentials. Mage-OS 2.2.0 replaces `magento/framework` 103.0.8-p4,
4949
Magento 2.4.8-p4's framework: the closest booted line to a Magento 2.4.8 shop, not proof of one.
5050

51-
## Two backends, and Composer enforces it
51+
## Three backends, and Composer enforces the bridges' absence
5252

53-
Magento reaches **in-memory** and **Temporal**, and nothing else. The module declares `conflict` on
54-
both SQL bridges, because `Magento\Framework\App\ResourceConnection` is neither Doctrine DBAL nor
55-
Illuminate's connection. This is the final shape, not a stage: an incoherent install is refused by
56-
the dependency solver rather than by a runtime check nobody reads.
53+
Magento reaches **in-memory**, its own **database** backend and **Temporal**. The module declares
54+
`conflict` on both SQL bridges, because `Magento\Framework\App\ResourceConnection` is neither
55+
Doctrine DBAL nor Illuminate's connection: the database backend is an adapter of this module, built
56+
on that connection layer (DUR056). An install with a bridge is refused by the dependency solver
57+
rather than by a runtime check nobody reads.
5758

58-
Which backend you get is decided by a DSN in `app/etc/env.php`, not by a setting:
59+
`app/etc/env.php` selects the backend. Declare a journal connection under `db/connection` and name
60+
it in `resource/durable` to select the database (`bin/magento durable:setup` creates the tables, and
61+
`bin/magento durable:worker` drains their queues):
62+
63+
```php
64+
'db' => ['connection' => ['durable' => [/* host, dbname, username, password... */]]],
65+
'resource' => ['durable' => ['connection' => 'durable']],
66+
```
67+
68+
A DSN selects Temporal instead:
5969

6070
```php
6171
'durable' => [
6272
'temporal' => ['dsn' => 'temporal://temporal:7233?namespace=default&tls=0'],
6373
],
6474
```
6575

66-
Without it the journal lives in the process that writes it, and dies with it — fine for a console
67-
command, ruinous for anything served by PHP-FPM.
76+
Declaring both throws `BackendSelectionException` the first time the module resolves its journal.
77+
Without either the journal lives in the process that writes it, and dies with it, which suits a
78+
console command, ruinous for anything served by PHP-FPM.
6879

6980
With `transport=guzzle` in the DSN, gRPC travels through Guzzle 7.14 or newer, which Magento
7081
already ships. To hand it the application's client — its proxy, its TLS options — set the
@@ -281,10 +292,11 @@ cluster.
281292

282293
**Nothing rides Magento's `MessageQueue`.** On Temporal an activity is a Temporal command and a
283294
resume is a workflow task; a topic here would be a second queue for an operator to supervise, for
284-
nothing. Magento has no native journal of its own and will not get one.
295+
nothing.
285296

286-
**There is no SQL journal on `ResourceConnection`**, and none is planned — see the two backends
287-
above.
297+
**The database backend does not use the SQL bridges.** It keeps its journal through
298+
`ResourceConnection` on a dedicated `db/connection/durable`, selected by `resource/durable`; see
299+
[Three backends](#three-backends-and-composer-enforces-the-bridges-absence).
288300

289301
## License
290302

0 commit comments

Comments
 (0)