Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@weaverryan
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?TODO
Fixed tickets#29950
LicenseMIT
Doc PRsymfony/symfony-docs#11236

Hi!

This builds on top of#30008. In fact, I would beperfectly 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:

  1. A newAmqpRoutingKeyStamp that allows you to configure the routing key
  2. The ability to define multiple queues on an AMQP transport, each bound to 0 or more routing keys.

It also fixes a few things I'm pretty sure were wrong - specifically theattributes 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!

Guillaume Gammelinand others added2 commitsMarch 28, 2019 14:15
…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.
$this->queue()->bind($this->exchange()->getName(),$this->queueConfiguration['routing_key'] ??null);
foreach ($this->queuesConfigurationas$queueName =>$queueConfig) {
$this->queue($queueName)->declareQueue();
foreach ($queueConfig['routing_keys'] ?? []as$routingKey) {
Copy link

@bentcoderbentcoderMar 29, 2019
edited
Loading

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 madehere. Am I correct?

Copy link
MemberAuthor

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 behalfand 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->queuesConfigurationas$queueName =>$queueConfig) {
$this->queue($queueName)->declareQueue();
foreach ($queueConfig['routing_keys'] ?? []as$routingKey) {

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 renamerouting_keys tobinding_keys for this binding part (also in constructor doc)

weaverryan reacted with thumbs up emoji
@bentcoder
Copy link

@weaverryan My comment above referes to section below:

e.g.framework:    messenger:        transports:            amqp:                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'                options:                    ...                    queue:                        ...                        routing_keys: ['key_1', 'key_2' ...]

@weaverryan
Copy link
MemberAuthor

@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.

bentcoder reacted with thumbs up emoji

@weaverryan
Copy link
MemberAuthor

Happily closing in favor of@G15N continuing the work on#30008

@weaverryanweaverryan deleted the amqp-multiple-queues-routing-keys branchMarch 31, 2019 16:00
@nicolas-grekasnicolas-grekas modified the milestones:next,4.3Apr 30, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@srozesrozeAwaiting requested review from sroze

2 more reviewers

@bentcoderbentcoderbentcoder left review comments

@JuGa013JuGa013JuGa013 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.3

Development

Successfully merging this pull request may close these issues.

5 participants

@weaverryan@bentcoder@JuGa013@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp