rupesh
rupesh

Reputation: 433

Is message lost when there's n/w issue while publishing the message to RabbitMQ?

I am using Spring AMQP to publish messages to RabbitMQ. Consider a scenario:
1. Java client sends a message to MQ usin amqpTemplate.convertAndSend()
2. But RabbitMQ is down OR there's some n/w issue

In this case the message will be lost? OR Is there any way it'll be persisted and will be retried?

I checked the publish-confirm model as well but as I understood, ultimately we've to handle the nack messages through coding on our own.

Upvotes: 0

Views: 431

Answers (1)

Gary Russell
Gary Russell

Reputation: 174494

The RabbitTemplate supports adding a RetryTemplate which can be configured whit whatever retry semantics you want. It will handle situations when the broker is down.

See Adding Retry Capabilities.

You can use a transaction or publisher confirms to ensure rabbit secured the message.

Upvotes: 1

Related Questions