spring integration - How to prevent AMQP (RabbitMQ) message from being black holed when the connection to the broker dies? -
for example, if there's network outage , producer loses connection rabbitmq broke, how can prevent messages being black holed need queued up? have few ideas 1 of them being write messages local db , remove them once they're acked , periodically resend after time period, works if connection factory set have publisher confirm.
i'm generating messages test application simulate event logging. i'm trying create durable producer. there way detect when can reconnect rabbitmq also? see there's connectionlistener interface, seems cannot send messages flush internal queue in connectionlistener.
if have simplemessagelistenercontainer
(perhaps listening dummy queue) keep trying reconnect (and fire connection listener when successful). or can have simple looper calls createconnection()
on connection factory time-to-time (it won't create new connection each time, return single shared connection - if open); fire listener when new connection made.
you can use transactions instead of publisher confirms - they're slower due handshake. depends on performance requirements are.
Comments
Post a Comment