[Messenger] [WIP] Be able to start a worker for multiple queues with custom consumption priorities
| Q | A |
|---|---|
| Branch? | 6.2 |
| Bug fix? | no |
| New feature? | yes |
| Deprecations? | no |
| Tickets | Fix #45882 --> |
| License | MIT |
| Doc PR | todo |
- [ ] fix the tests as they have not been updated yet
- [ ] submit changes to the documentation
- [ ] document the BC breaks
- [ ] finish the code
- [ ] gather feedback for my changes
This PR adds a way to run the messenger worker with different, potentially custom execution strategies. Beside extracting the current "execution strategy", it also adds a new one: "com.symfony.ranked", which satisfies the requirements described in the related ticket: #45882.
An example that demonstrates the entire feature:
bin/console messenger:consume queue_a queue_b queue_b_low queue_b_lowest queue_c \
--strategy="com.symfony.ranked" \
--strategy-config="{\"ranks\": [1, 1, 2, 3, 1]}"
At present, I would like to gather feedback for my changes before I go ahead and fix/write tests, etc. The code does work, however, as I integration-tested it in my test project.
Regarding BC, the feature might be breaking the compatibility because it adds a new required __construct() argument to the following classes: ConsumeMessagesCommand, Worker (this one is, however, annotated as final, so perhaps BC might not be a concern here). Please let me know if this indeed is a BC break. If yes, I'd appreciate a proposition on how to work around it (perhaps setter injection could be used instead, but it has its own downsides).