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

Skip to content

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

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 3 commits into
base: 7.4
Choose a base branch
from

Conversation

ThomasBeauchataud
Copy link

Q A
Branch ? 6.1
Bug fix ? no
New feature ? yes
Deprecations ? no
Tickets #45882
License MIT
Doc PR

This feature in the first part of the issue #45882.

Thanks to this feature, we no longer have to order receivers the command argument, but we can simply set their priority in the argument as follows :

bin/console messenger:consume async_lower^3 async_high^1 async_med^2
is equivalent to
bin/console messenger:consume order async_high async_med, async_low
This is very convenient when you have a lot of receivers.

When the PR #44294 well be ready, we will be able to create a mixed strategy to allow some receivers to have the same priority, and run them with turn by turn

Customization of the receivers priorities thanks to a specification in the command argument `bin/console messenger:consume async_redis^2 async_doctrine^1`
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@fabpot fabpot modified the milestones: 6.1, 6.2 May 13, 2022
@carsonbot
Copy link

Hey!

I think @upyx has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@upyx
Copy link
Contributor

upyx commented May 13, 2022

IMO that adds more problems than solves. The syntax is unsightly, and configuring is tricky.

The ordering of consuming messages has been implemented already. It's well documented, simple to understand, easy to use, and covers most cases. For additional flexibility, it is possible to add a custom transport that aggregates others and implements any ordering logic. Moreover, custom transports are more flexible than any strategies: they can be used like strategies and can include them.

I think it would be nice to keep things simple for maintenance and use.

If you'd like, I can help you to implement exactly the same feature by transports instead of extending workers.

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.

6 participants