I want to make the messages in the queues persistent, so they don't vanish when the queues restart. The queues are already durable so I only need to make the messages persistent. It is weird how the devdocs dont write anything about it. And when I look into the RabbitMQ documentation + other sources on the topic, they all write that I have to change the deploy_mode to 2. But nobody writes how and where to do that. I found a place in the source code about it but there it is already set to 2:
vendor/magento/framework-amqp/Queue.php
/**
* @inheritdoc
* @since 103.0.0
*/
public function push(EnvelopeInterface $envelope)
{
$messageProperties = $envelope->getProperties();
$msg = new AMQPMessage(
$envelope->getBody(),
[
'correlation_id' => $messageProperties['correlation_id'],
'delivery_mode' => 2
]
);
$this->amqpConfig->getChannel()->basic_publish($msg, '', $this->queueName);
}
But the messages are still not persisted.
A post on Stack Overflow suggested to change it on the Exchanger altering the publish(...) But the problem is that the Exchanger has no publish(...) method.
So how and where can I change the deploy mode properly?