-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Messenger] Add AMQP exchange to exchange binding reference #16783
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
Samik081
wants to merge
2
commits into
symfony:7.4
Choose a base branch
from
Samik081:amqp-exch2exch-binding-docs
base: 7.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ebf629c
to
801bcf8
Compare
801bcf8
to
6477337
Compare
6477337
to
bc19829
Compare
bc19829
to
e3f18ed
Compare
e3f18ed
to
1ebd353
Compare
1ebd353
to
75b60c6
Compare
75b60c6
to
0f644ca
Compare
fabpot
added a commit
to symfony/symfony
that referenced
this pull request
Sep 17, 2025
…mik081) This PR was squashed before being merged into the 7.4 branch. Discussion ---------- [Messenger] Add AMQP exchange to exchange bindings ## Q/A | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | symfony/symfony-docs#16783 ## 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-exchange` bindings in `amqp` transport. This feature uses `\AMQPExchange::bind()` method already provided by the stub in `php-amqp/php-amqp`: https://github.com/php-amqp/php-amqp/blob/bb7611220e341039a7f5d72e606ca1e16eda4642/stubs/AMQPExchange.php#L22 Example `messenger.yaml`: ```yaml framework: messenger: transports: some_transport: dsn: 'amqp://' options: exchange: type: topic name: some_exchange bindings: # added configuration another_exchange: binding_keys: - key1 - key2 binding_arguments: x-match: all ``` With the above configuration, the `Connection` class creates `some_exchange` and binds it to `another_exchange` using `['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 `topic` type): ``` App `Foo` publishes events to its own exchange AND subscribes to the events that app `Bar` publishes on its exchange. App `Bar` publishes events to its own exchange AND subscribes to the events that app `Foo` publishes on its exchange. App `...` subscribes to the events that apps `Foo` and `Bar` publish on their exchanges. ``` 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 in `symfony/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 within `amqp-messenger` seems reasonable to me. Commits ------- 9fd9049 [Messenger] Add AMQP exchange to exchange bindings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Documents symfony/symfony#46257