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

[Messenger] Add a way to only call the handler assigned to a queue #30110

Open
tkocjan opened this Issue Feb 7, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@tkocjan
Copy link

tkocjan commented Feb 7, 2019

Description
With RabbitMQ you can set up a topic in a pub/sub configuration by binding multiple queues to one exchange. You can configure messenger transports to those different queues. The message is sent to the exchange and the same message is posted to both queues. A worker on one queue performs one type of operation (like sending an email) and another worker on the other queue performs a different operation (like sending an SMS).

Here is the problem:

You can set up workers to each of the queues through the transport with “bin/console messenger:consume-messages [transport]”, that works great. The problem is that both workers call both handlers because the message class in both handlers is the same. What is needed is a way to specify the handlers for each worker.

@Tobion

This comment has been minimized.

Copy link
Member

Tobion commented Feb 8, 2019

It should be possible to implement this with a custom Envelope stamp and a custom https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Messenger/Handler/HandlersLocatorInterface.php so that it only calls the handler that fits with the stamp

@Tobion

This comment has been minimized.

Copy link
Member

Tobion commented Feb 8, 2019

See discussion in #29045

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