SpinGo/op-rabbit

Application Losing messages when RabbitMQ is not available and the Application crashes during that period

AbacusIntegrationPlatform opened this issue · 2 comments

I am having an issue where RabbitMQ Connection is getting disconnected intermittently. Op-Rabbit is able to recover the connection if it is available for a short period of time as it persists/queues the messages in the actor. But if the application crashes when the rabbit MQ is down, the persisted messages in the Actor is getting lost as it is in-memory persistence. I want this error to be thrown out rather than persisting it in the actor memory. I am using a default publisher as below.

val publisher = Publisher.queue(QName)   
rabbitControl ! Message(jsonString, publisher)

Publisher confirmations is what you're looking for:

https://github.com/SpinGo/op-rabbit#publish-a-message

@timcharper Thank you.

I tried with this way given -
val received = (
rabbitControl ? Message.queue(jsonmsg,queue = "demoqueue")).mapTo[ConfirmResponse]

Still, if there is a connection failure, it is internally retrying rather than throwing error out. Is there a way to throw the error so that i can send Nack to the source ?