[rabbitmq-discuss] Lose messages between restarts of broker
rwirth at demandware.com
Thu Oct 28 19:50:43 BST 2010
> If you really need messages to go safely to disk, then you should put
> the channel into transactional mode (tx.select), and issue a tx.commit
What about unacknowledged messages?
A Producer (rabbit 2.1.1 java client, not Spring Rabbit AMQP) commits some persistent messages on a durable queue/exchange.
The Consumer is neither ack'ing nor rejecting the message to leave it on the queue (and let recovery retry it later), but I am committing periodically, e.g.:
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
// neither channel.basicReject or Ack
$ rabbitmqctl list_queues name messages messages_unacknowledged messages_ready
Listing queues ...
testQueue 5 5 0
Using a soft "rabbitmqctl stop", a Broker restart will make the unacknowledged messages ready again (as expected).
testQueue 5 0 5
With a Broker hardkill, the unack'd messages disappear.
testQueue 0 0 0
For our implementation, I was going to rely on unacknowledged messages, flow control (qos) and periodic channel.basicRecover() to implement a crude, controlled "delayed retry" behavior, without using a temporary parking queue or application-provided intermediate storage. Not that anyone would kill the broker but is there a way to flush unack'd messages to disk?
This e-mail message and all attachments transmitted with it may contain privileged and/or confidential information intended solely for the use of the addressee(s). If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message, all attachments and all copies and backups thereof.
More information about the rabbitmq-discuss