rabbitmqctl - How to read RabbitMQ unacknowledged messages / RabbitMQ cycle -


i want read payload, or messageid of unacknowledged messages in rabbitmq queue. possible?

the reason want trying use rabbitmq dead letter feature build cycle auto-generating message periodically. briefly, create 2 queues - work queue , delay queue.

  1. set ttl of message in delay queue time frequency of need periodically. can have different messages different ttl different job purpose;
  2. put message delay queue. when message expires, gets republished work queue. message can sit in work queue long needed until consumer consume it.
  3. one consumer picks message, , process it. if processing succeeds, consumer needs acknowledge work queue, , write message delay queue; if processing fails (e.g., thread crashes), no acknowledgement. message re-appear in worker queue automatically. consumer can take job. when message sent delay queue gets expired again, gets republished, re-consumed consumer ...... cycle constructed, workload distributed.

i want make sure there no missing or duplicate messages in cycle since not want missing job or double doing job @ same time. however, there tiny tiny chance duplicate messages can happen. below show consumer first write message delay queue, , acknowledge work queue. if thread crashes right between below 2 lines, message in delay queue, , rabbit republish message again work queue. end duplicate messages in cycle.

  channel.basicpublish(delay_exchange, "", null, message.getbytes());   channel.basicack(delivery.getenvelope().getdeliverytag(), false); 

to prevent above, want add dog watch logic after above 2 line:

  1. check total number of messages in cycle (total messages in both queues) see whether equal expected number (i expected number less 10);

  2. if number not matches, want figure out 1 missing or 1 duplicate, deal it. not care sequence of messages, or frequency has been disturbed since really edge case consider. can retrieve messages ready , requeue them. problem how deal unacknowledged messages?

thank in advance!

roy

it's not possible read unacknowledged messages other context original messages consumed , held un-aked.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -