Search code examples
rabbitmqspring-amqpspring-rabbit

Why ConfirmCallback#confirm#CorrelationData has only one property id rather than the entire message so that i can resend message immediately


I am trying some stuff about Reliability of message delivery using ConfirmCallback.

So far I've done these:

1.When I send a message, I save it in the db (There is a field called status that indicates whether the message reached the broker successfully). Message id will stored in correlationData.

2.Using ConfirmCallback, if ack, i will update Message#status to success.( I can get message id from CorrelationData )

3.Using timed tasks to find the message that was not sent successfully, and resend.

I wonder why ConfirmCallback#confirm#CorrelationData has only one property id rather than the entire message so that I can resend message immediately.(In this way I don't need to persist messages).

Is there any other way to ensure that the message is sent successfully?

Any Suggestions would be appreciated.


Solution

  • You can sub-class CorrelationData to add the message.