Hi all,<div><br></div><div>I'm new to RabbitMQ and I am still trying to put everything together, so please be patient.</div><div><br></div><div>What I want to achieve is a queue in which all the messages persist until a "consumer" (not sure if it is really a consumer actually) do some batch processing on N messages, like updating a separate DB, and, only when everything has completed correctly, send an acknowledge so that the queue can release the last delivered N messages.</div>
<div>As per my understanding I can "declare" a queue and then start reading from it using basicGet() API. Then, after processing the desired number of messages, I call basicAck(deliveryTag, true) passing the tag of the last read message.</div>
<div>In my case it is both important to keep the message ordering and not to lose any message even if the consumer or the broker crash. In order to achieve that, I am going to publish messages "mandatory" and "persistent" and then send an ack in the consumer after successfully securing the data in some other place.</div>
<div>What I want to be clear here is: is it correct to say that if the consumer crashes after M basicGet() (but before sending the ack), at restart the same M messages will be returned calling basicGet()? I.e. are the messages removed from the queue only after receiving the acknowledge?</div>
<div>If it is not so, do I have to call basicRecover()? Can I do it even if I don't call basicConsume()? And most importantly, which is the order of the messages when calling basicRecover() after a crash and restart of the consumer node?</div>
<div><br></div><div>A final question: if a message is flagged as "mandatory", how long the queue wait for a consumer to be ready before returning the message to the sender?</div><div><br></div><div>Thanks and Best Regards,</div>
<div><br></div><div>Davide</div>