-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Messenger] Add AMQP exchange to exchange bindings #46257
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
Conversation
|
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:
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! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
|
Hey! I think @ruudk has recently worked with this code. Maybe they can help review this? Cheers! Carsonbot |
1b341a5 to
124b5f8
Compare
2f89e25 to
16f7122
Compare
16f7122 to
af915cd
Compare
09c351c to
e5dfa54
Compare
d39e7db to
a304cd5
Compare
a304cd5 to
1331e74
Compare
1331e74 to
6021296
Compare
6021296 to
928a2a2
Compare
|
Hi @nicolas-grekas, @xabbuh, Apologies for the direct ping, but I'm trying to get some attention on this PR. I saw your recent reviews on the This feature is still very much needed for my projects and company; we've been relying on workarounds for years. Integrating this into the Messenger component would be a significant improvement for us. Is there any possibility of a review, or could you advise on who might be best to ask? Thanks a lot! |
|
Aside of the fact that this is already supported by the underlying php-amqplib and therefore supporting it also by symfony messenger should be natural and useful. |
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
nicolas-grekas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No objection to merge this on my side. I just have a technical comment.
src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php
Outdated
Show resolved
Hide resolved
|
Big thanks for the review and a catch, @nicolas-grekas, I really appreciate that! |
333e5cd to
9fd9049
Compare
|
Thank you @Samik081. |
Q/A
Changes description
This PR introduces very similar changes to this one: #34737, which was closed due to the lack of the feedback.
I'd like to continue this topic, share the missing feedback and discuss it further if needed.
I have introduced the possibility to configure
exchange-to-exchangebindings inamqptransport. This feature uses\AMQPExchange::bind()method already provided by the stub inphp-amqp/php-amqp: https://github.com/php-amqp/php-amqp/blob/bb7611220e341039a7f5d72e606ca1e16eda4642/stubs/AMQPExchange.php#L22Example
messenger.yaml:With the above configuration, the
Connectionclass createssome_exchangeand binds it toanother_exchangeusing['key1', 'key2']keys and[x-match =>'all']arguments.Reasoning
Binding an exchange to an exchange feature can be used to create more complex RabbitMQ topologies. It is also briefly described here: https://www.cloudamqp.com/blog/exchange-to-exchange-binding-in-rabbitmq.html
A real-world example could be kind of RabbitMQ publisher/subscriber pattern implementation between microservices, that could be visualized as follows:
In the above example (all the exchanges in this example are of the
topictype):This approach might have few advantages, such as easier maintainability, dependency management and monitoring, or better separation between microservices.
My thoughts
I feel that the fact, that https://github.com/php-amqp/php-amqp has
\AMQPExchange::bind()implemented is already sufficient reason to have this supported insymfony/amqp-messenger. I am aware this feature might be rarely used, but it's already there in the extension, and having the ability to use it withinamqp-messengerseems reasonable to me.