-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] AMQP configurable routing key & multiple queues #30770
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] AMQP configurable routing key & multiple queues #30770
Conversation
…ents' into amqp-multiple-queues-routing-keys * G15N/ticket-29950-bus-dispatch-enhancements: [messenger] Adds a stamp to provide a routing key on message publishing.
ad8f4d8
to
3444173
Compare
$this->queue()->bind($this->exchange()->getName(), $this->queueConfiguration['routing_key'] ?? null); | ||
foreach ($this->queuesConfiguration as $queueName => $queueConfig) { | ||
$this->queue($queueName)->declareQueue(); | ||
foreach ($queueConfig['routing_keys'] ?? [] as $routingKey) { |
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.
@weaverryan Just to confirm, as far as I understand, this line addresses the first point (AMQP configuration) I made here. Am I correct?
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.
I’m not sure exactly which was your first point. But this part allows you to declare that you want messenger to create multiple queues on your behalf and create multiple binds for each queue. I’m pretty sure this was at least one of your issues :). This part is all about creating and binding of queues - these specific lines say nothing about the publishing process or what routing keys are used.
$this->queue()->bind($this->exchange()->getName(), $this->queueConfiguration['routing_key'] ?? null); | ||
foreach ($this->queuesConfiguration as $queueName => $queueConfig) { | ||
$this->queue($queueName)->declareQueue(); | ||
foreach ($queueConfig['routing_keys'] ?? [] as $routingKey) { |
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.
@weaverryan , don't forget to rename routing_keys
to binding_keys
for this binding part (also in constructor doc)
@weaverryan My comment above referes to section below:
|
@bentcoder yep, then that code is indeed doing what you want. It allows you to bind multiple routing keys to the queue, though we may rename them to binding_keys, I think that’s more accurate. |
Hi!
This builds on top of #30008. In fact, I would be perfectly happy if @G15N pulled in my commit into his branch and finished it on his PR (we would close this one then). I just wanted to make sure the 2nd half got done.
This adds 2 things:
AmqpRoutingKeyStamp
that allows you to configure the routing keyIt also fixes a few things I'm pretty sure were wrong - specifically the
attributes
andflags
configuration for a queue were also sent when publishing a message. I don't think that makes sense: when you're publishing a message, you have no idea what queue you will go to. These 2 options are now NOT configurable for each message, which makes me wonder if we should add 2 new stamps for these, or merge onto one biggerAmqpConfigurationStamp
class.Cheers!