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] expire delay queue and fix auto_setup logic #32631
Conversation
'exchange_name' => 'delay', | ||
'queue_name_pattern' => 'delay_queue_%exchange_name%_%routing_key%_%delay%', | ||
'queue_name_pattern' => 'delay_%exchange_name%_%routing_key%_%delay%', |
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.
we need to change the name because of the new x-expire argument which would otherwise cause a precondition failed error on redeclaring. but the name is an implementation detail and should not matter.
@@ -213,9 +211,7 @@ private function publishWithDelay(string $body, array $headers, int $delay, Amqp | |||
{ | |||
$routingKey = $this->getRoutingKeyForMessage($amqpStamp); | |||
|
|||
if ($this->shouldSetup()) { |
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.
delay must ignore the auto_setup option as explained below
@@ -342,11 +341,8 @@ public function nack(\AMQPEnvelope $message, string $queueName, int $flags = AMQ | |||
|
|||
public function setup(): void | |||
{ | |||
if (!$this->channel()->isConnected()) { | |||
$this->clear(); |
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.
this should also happen when auto_setup is not enabled to reconnect when necessary. so I moved it outside setup()
$this->exchange()->declareExchange(); | ||
$this->getDelayExchange()->declareExchange(); |
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.
setup is called from messenger:setup-transports which should also create the delay exchange. this way, auto_setup can actually be disabled successfully even when using delays/retries
75f1f0e
to
26140f9
Compare
test failure unrelated |
26140f9
to
7aee83a
Compare
…obion) This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] expire delay queue and fix auto_setup logic | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32588 | License | MIT | Doc PR | Tested successfully Commits ------- 7aee83a [Messenger] expire delay queue and fix auto_setup logic
…e normal ones by default (Tobion) This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] make delay exchange and queues durable like the normal ones by default | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #32891 | License | MIT | Doc PR | This also imrproves BC of #32631 by only adding the new expiry argument in case the delay queue name was not overwritten using the options. I will remove the checks in 4.4 again. Please merge this PR before releasing the new 4.3 version so that 32631 and this PR are part of one release. Commits ------- e5ecda6 [Messenger] make delay exchange and queues durable like the normal ones by default
Tested successfully