-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger][AMQP] Support for RabbitMQ Quorum Queues in delayed queues #46254
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
Comments
Thank you for this issue. |
I am not 100% sure, but I think this has not been implemented already. |
Shouldn't it be easy to add this by extending if (isset($this->exchangeOptions['arguments'])) {
$this->amqpExchange->setArguments($this->exchangeOptions['arguments']);
} |
Close enough, it worked for me like this: private function createDelayQueue(int $delay, ?string $routingKey, bool $isRetryAttempt): \AMQPQueue
{
$queue = $this->amqpFactory->createQueue($this->channel());
$queue->setName($this->getRoutingKeyForDelay($delay, $routingKey, $isRetryAttempt));
$queue->setFlags(\AMQP_DURABLE);
$arguments = [
'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,
// message should be broadcasted to all consumers during delay, but to only one queue during retry
// empty name is default direct exchange
'x-dead-letter-exchange' => $isRetryAttempt ? '' : $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 ?? '',
];
if (!empty($this->queuesOptions[$routingKey]['arguments'])) {
$arguments = array_merge($this->queuesOptions[$routingKey]['arguments'], $arguments);
}
$queue->setArguments($arguments);
return $queue;
} |
I can create a PR tomorrow ... |
Thank you for this issue. |
Friendly ping? Should this still be open? I will close if I don't hear anything. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
@carsonbot This is still a valid issue until #48603 has been merged. |
…lay queues (Thomas Beaujean) This PR was merged into the 7.1 branch. Discussion ---------- [Messenger][Amqp] Add config option 'arguments' for delay queues | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #44186 #46254 | License | MIT | Doc PR | symfony/symfony-docs#17553 Hi, this PR to allow to add extra arguments to the amqp delay queues that are automatically created. The use case: - I do not know in advance the name of the queues (handled by env variables) - The queues are created automatically by symfony if needed - I need the deduplication plugin in both the queue and the associated delays queues (enabled with the x-message-deduplication argument) - I do not want to rewrite all delay arguments, I just want to be able to add or rewrite some The associated configuration in messenger.yaml ``` transports: async: dsn: '%env(MESSENGER_DSN)%' options: queues: '%env(MESSENGER_ASYNC_QUEUE_NAME)%': arguments: x-queue-type: 'classic' x-message-deduplication: true delay: arguments: x-queue-type: 'classic' x-message-deduplication: true ``` Commits ------- 94ee8a2 [Messenger] Add config option 'arguments' for delay queues
Description
Hi!
Quorum Queues were introduced in RabbitMQ 3.8.0.
Since 3.10.0 it supports
x-message-ttl
which is used bySymfony\Component\Messenger\Bridge\Amqp\Transport\Connection::createDelayQueue()
- it was basically the missing piece to be able to use quorum queues for delayed queues.Right now there is no way to configure messenger so it creates delayed queues as quorum.
Quote from the documentation:
Apart of the
x-queue-type
it would be great to be able to pass more arguments for delyed queues, likex-quorum-initial-group-size
.Example
No response
The text was updated successfully, but these errors were encountered: