Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] [WIP] Be able to start a worker for multiple queues with custom consumption priorities #47602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

Conversation

d-ph
Copy link

@d-ph d-ph commented Sep 16, 2022

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).

@carsonbot carsonbot added this to the 6.2 milestone Sep 16, 2022
@carsonbot carsonbot changed the title [WIP] [Messenger] Be able to start a worker for multiple queues with custom consumption priorities [Messenger] [WIP] Be able to start a worker for multiple queues with custom consumption priorities Sep 16, 2022
@nicolas-grekas nicolas-grekas modified the milestones: 6.2, 6.3 Nov 5, 2022
@nicolas-grekas nicolas-grekas modified the milestones: 6.3, 6.4 May 23, 2023
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Messenger] Be able to start a worker for multiple queues with custom consumption priorities
5 participants