Wit hthe help of the upstream IRC I found that the durable queue only makes the queue durable. As outlined in my former [1].
TL;DR I need to persist the messages on publish. In my example that is
channel.basic_publish(exchange='', - routing_key='hello', - body='Hello World!') + routing_key='hellod', + body='Hello World!', + properties=pika.BasicProperties( + delivery_mode = 2, # make message persistent + )) print(" [x] Sent 'Hello World!'") connection.close()
With that it survives a restart
root@x:~# ./send.py [x] Sent 'Hello World!' root@x:~# ./send.py [x] Sent 'Hello World!' root@x:~# rabbitmqctl list_queues name durable messages Listing queues ... hellod true 2 root@x:~# systemctl restart rabbitmq-server root@x:~# rabbitmqctl list_queues name durable messages Listing queues ... hellod true 2 root@x:~# ./receive.py [x] Received 'Hello World!' [x] Received 'Hello World!'
@Iain have we lost messages that were in persistent deliver mode or might that have been what happened?
Wit hthe help of the upstream IRC I found that the durable queue only makes the queue durable.
As outlined in my former [1].
TL;DR I need to persist the messages on publish.
In my example that is
channel. basic_publish( exchange= '', key='hello' , key='hellod' , pika.BasicPrope rties(
- routing_
- body='Hello World!')
+ routing_
+ body='Hello World!',
+ properties=
+ delivery_mode = 2, # make message persistent
+ ))
print(" [x] Sent 'Hello World!'")
connection.close()
With that it survives a restart
root@x:~# ./send.py
[x] Sent 'Hello World!'
root@x:~# ./send.py
[x] Sent 'Hello World!'
root@x:~# rabbitmqctl list_queues name durable messages
Listing queues ...
hellod true 2
root@x:~# systemctl restart rabbitmq-server
root@x:~# rabbitmqctl list_queues name durable messages
Listing queues ...
hellod true 2
root@x:~# ./receive.py
[x] Received 'Hello World!'
[x] Received 'Hello World!'
@Iain have we lost messages that were in persistent deliver mode or might that have been what happened?