Queues and cron

โ† Queues and cron

Ashterix

docs(articles): Magento and Symfony examples side by side, request lifecycle as a Mermaid diagram

en/articles/magento-to-symfony/infrastructure/async.md +12 โˆ’2

1 1 # Queues and cron
2 2
3 + ::::columns
4 + :::col
3 5 **Magento** ยท four XML files and a publisher
4 6
5 7 ```xml
19 21 }
20 22 }
21 23 ```
22 โˆ’
24 + :::
25 + :::col
23 26 **Symfony** ยท message, handler, routing
24 27
25 28 ```php
39 42
40 43 $this->bus->dispatch(new ReindexProduct($product->getId()));
41 44 ```
45 + :::
46 + ::::
42 47
43 48 **Symfony** ยท config/packages/messenger.yaml
44 49
62 67
63 68 ## crontab.xml โ†’ Scheduler
64 69
70 + ::::columns
71 + :::col
65 72 **Magento** ยท crontab.xml
66 73
67 74 ```xml
73 80 </job>
74 81 </group>
75 82 ```
76 โˆ’
83 + :::
84 + :::col
77 85 **Symfony** ยท symfony/scheduler
78 86
79 87 ```php
91 99 # the schedule is run by a Messenger worker:
92 100 # bin/console messenger:consume scheduler_default
93 101 ```
102 + :::
103 + ::::
94 104
95 105 An alternative without Scheduler is a regular console command in the system crontab. For tasks that must not run in parallel on several servers, add the Lock component.