Skip to content

[Messenger] Add message priority feature for Messenger #41573

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
kozlice opened this issue Jun 6, 2021 · 9 comments · May be fixed by #41574
Open

[Messenger] Add message priority feature for Messenger #41573

kozlice opened this issue Jun 6, 2021 · 9 comments · May be fixed by #41574

Comments

@kozlice
Copy link

kozlice commented Jun 6, 2021

Description
Provide possibility to prioritize messages of the same type by introduction of PriorityStamp.

Messenger currently offers prioritized transports. It only works fine when you define priority per message type.

Currently I'm working on a project where we needed a priority queue. Requests coming from certain users should be handled first. It is possible to do so:

# Fragment of messenger.yaml: define x-max-priority for RabbitMQ queue via config
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    queues:
                        app.messenger:
                            arguments:
                                x-max-priority: 255
$stamp = new AmqpStamp(null, \AMQP_NOPARAM, ['priority' => 127]);
$this->eventBus->dispatch($event, [$stamp]);

But there are at least two problems here:

  1. We are forced to decide routing key & AMQP params. Message producer should not be aware of these details
  2. It's not adapter-agnostic. Beanstalkd also supports priority, but is hardcoded and cannot be configured

Currently working on a PR, will submit it soon.

@kozlice kozlice changed the title Add message priority feature for Messenger [Messenger] Add message priority feature for Messenger Jun 6, 2021
@kozlice kozlice linked a pull request Jun 6, 2021 that will close this issue
4 tasks
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@kozlice
Copy link
Author

kozlice commented Dec 27, 2021

@carsonbot Yes. And there is a PR waiting for review.

@carsonbot carsonbot removed the Stalled label Dec 27, 2021
@julien-donnadieu
Copy link

Hello there, should be very appreciated

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@enumag
Copy link
Contributor

enumag commented Mar 2, 2023

yes

@carsonbot carsonbot removed the Stalled label Mar 2, 2023
@qnixdev
Copy link

qnixdev commented Jul 20, 2023

yes

@gaetan-petit
Copy link

This would be very useful!

@positron48
Copy link

I needed it too

@jg-development
Copy link

me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants