Skip to content

Commit

Permalink
minor #33245 [Messenger] remove patch release BC layer of durable and…
Browse files Browse the repository at this point in the history
… expiring delay (Tobion)

This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] remove patch release BC layer of durable and expiring delay

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| 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 |
| License       | MIT
| Doc PR        |

Removes the small BC layer of #33127 from 4.3 in 4.4

Commits
-------

d5aaf44 [Messenger] remove patch release BC layer of durable and expiring delay
  • Loading branch information
fabpot committed Aug 21, 2019
2 parents 22319a9 + d5aaf44 commit 5a753b1
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
Expand Up @@ -251,11 +251,7 @@ private function getDelayExchange(): \AMQPExchange
$this->amqpDelayExchange = $this->amqpFactory->createExchange($this->channel());
$this->amqpDelayExchange->setName($this->connectionOptions['delay']['exchange_name']);
$this->amqpDelayExchange->setType(AMQP_EX_TYPE_DIRECT);
if ('delays' === $this->connectionOptions['delay']['exchange_name']) {
// only add the new flag when the name was not provided explicitly so we're using the new default name to prevent a redeclaration error
// the condition will be removed in 4.4
$this->amqpDelayExchange->setFlags(AMQP_DURABLE);
}
$this->amqpDelayExchange->setFlags(AMQP_DURABLE);
}

return $this->amqpDelayExchange;
Expand All @@ -278,24 +274,17 @@ private function createDelayQueue(int $delay, ?string $routingKey)
[$delay, $this->exchangeOptions['name'], $routingKey ?? ''],
$this->connectionOptions['delay']['queue_name_pattern']
));
if ('delay_%exchange_name%_%routing_key%_%delay%' === $this->connectionOptions['delay']['queue_name_pattern']) {
// the condition will be removed in 4.4
$queue->setFlags(AMQP_DURABLE);
$extraArguments = [
// delete the delay queue 10 seconds after the message expires
// publishing another message redeclares the queue which renews the lease
'x-expires' => $delay + 10000,
];
} else {
$extraArguments = [];
}
$queue->setFlags(AMQP_DURABLE);
$queue->setArguments([
'x-message-ttl' => $delay,
// delete the delay queue 10 seconds after the message expires
// publishing another message redeclares the queue which renews the lease
'x-expires' => $delay + 10000,
'x-dead-letter-exchange' => $this->exchangeOptions['name'],
// after being released from to DLX, make sure the original routing key will be used
// we must use an empty string instead of null for the argument to be picked up
'x-dead-letter-routing-key' => $routingKey ?? '',
] + $extraArguments);
]);

return $queue;
}
Expand Down

0 comments on commit 5a753b1

Please sign in to comment.