You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #30708 [Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports (weaverryan)
This PR was squashed before being merged into the 4.3-dev branch (closes#30708).
Discussion
----------
[Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | Helps with #30699
| License | MIT
| Doc PR | TODO
Highlights:
* `messenger:consume` can now consume messages from multiple transports with priority ❗️
```
bin/console messenger:consume amqp_high amqp_medium amqp_low
```
* How long you want to sleep before checking more messages is now an option to `messenger:consume`
* `ReceiverInterface::receive()` is replaced with `ReceiverInterface::get()`
* Logic for looping & sleeping is moved into `Worker`
Commits
-------
e800bd5 [Messenger] ReceiverInterface::handle() to get() & Worker with prioritized transports
@@ -70,10 +71,11 @@ protected function configure(): void
70
71
71
72
$this
72
73
->setDefinition([
73
-
newInputArgument('receiver', $defaultReceiverName ? InputArgument::OPTIONAL : InputArgument::REQUIRED, 'Name of the receiver', $defaultReceiverName),
74
+
newInputArgument('receivers', InputArgument::IS_ARRAY, 'Names of the receivers/transports to consume in order of priority', $defaultReceiverName ? [$defaultReceiverName] : []),
74
75
newInputOption('limit', 'l', InputOption::VALUE_REQUIRED, 'Limit the number of received messages'),
75
76
newInputOption('memory-limit', 'm', InputOption::VALUE_REQUIRED, 'The memory limit the worker can consume'),
76
77
newInputOption('time-limit', 't', InputOption::VALUE_REQUIRED, 'The time limit in seconds the worker can run'),
78
+
newInputOption('sleep', null, InputOption::VALUE_REQUIRED, 'Seconds to sleep before asking for new messages after no messages were found', 1),
77
79
newInputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to which received messages should be dispatched (if not passed, bus is determined automatically.'),
78
80
])
79
81
->setDescription('Consumes messages')
@@ -82,6 +84,10 @@ protected function configure(): void
0 commit comments