java - Put unacknowledged message(on exception) to a different queue in RabbitMQ -


on exception while processing message rabbitmq, wanted unacknowledg , put particular message difference queue instead or re-queue same queue or discard message(as per last boolean flag@requeue in basicnack).

the whole idea later on can count of unack message , check message format etc instead of re-queue again , again same channel , want sent unacknowledged signal current channel.

fyi set channel ack mode manual(i.e container.setacknowledgemode(acknowledgemode.manual);)

this doing now.

public class my***listener implements channelawaremessagelistener{  try{      @override     public void onmessage(message message,channel channel) throws exception {        string s = new string(message.getbody());     //some logic     //after successful ack manually     channel.basicack(message.getmessageproperties().getdeliverytag(),false);     } catch(exception e){       //currently on exception unack channel       channel.basicnack(message.getmessageproperties().getdeliverytag(),false,false); } 

any highly appreciable.

you can send them dead letter queue. it's pretty standard pattern.

https://www.rabbitmq.com/dlx.html


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -