Johan
Johan

Reputation: 40588

How to redeliver queued messages in RabbitMQ using Langohr?

Background

We consume messages from RabbitMQ with Langohr (version 3.4.0) and try to persist them into MongoDB. We're not using auto-ack since if we fail to persist the messages in MongoDB we want to be able to retry later. We're using the ack-unless-exception function to accommodate this. Tonight MongoDB had a temporary disruption and was down for a short period of time during which 40 messages couldn't be persisted and were thus retained in the RabbitMQ queue. But when MongoDB came back up again our Langohr handler just received new messages. The old ones were not delivered to us before we did a restart of our application.

Question

How can we make RabbitMQ redeliver the previous nack:ed messages with Langohr without having to restart our application?

Upvotes: 2

Views: 168

Answers (1)

Ward
Ward

Reputation: 2852

Undelivered messages are not automatically redelivered. You want to take a look at recover. This method will signal to RabbitMQ that is has to redeliver unprocessed messages. When you do this is depending on your architecture

Upvotes: 1

Related Questions