In RabbitMQ, this can be achieved using the durability of the queues and messages.
Queue durability means that its configuration will be stored on the disk. And when RabbitMQ recovers after a crash, the queue will be restored. It can be done thus :
channel.queue_declare(queue='myQueue', durable=True)
What you seek is more closely related to message durability. Publish all your messages with the delivery_mode flag set to 2. The default value is 1, which makes messages reside only in the RAM. See this for code samples in Python. Excerpt below.
channel.basic_publish(exchange='',
routing_key='task_queue',
body=message,
properties=pika.BasicProperties(
delivery_mode = 2, # make message persistent
))
Please note that enabling message durability has its effects on performance. When set to 2, RabbitMQ broker has to do the additional work
of writing messages to and reading them from the disk.