You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ishitori <Is...@bk.ru> on 2011/06/24 17:11:00 UTC

How to retry messages with Individual Acknowledge mode

Hi, I am using ActiveMQ 5.5.0 with NMS.

I want to make a reliable system and confirm that every message is
processed. I want to check that if I don't acknowledge the message it will
be redelivered again. I want to explicitely acknowldge every message so I
have picked Individual acknowledge mode. I have created a small WPF solution
and do the following: 

* send a message to a queue via ActiveMQBrowser
* After recieving a message I check an int counter: if it is 0 I throw an
exception and don't call the Acknowledge method on a message and if it is 1
I call acknowledge(). If an exception is thrown I change the conuter to 1 so
the next receiving would be processed
* I write a code to the listener and explicitly set redelivery options:

MaximumRedeliveries = 5,
InitialRedeliveryDelay = 1,
BackOffMultiplier = 2,
UseExponentialBackOff = true

(full source code is attached: 
http://activemq.2283324.n4.nabble.com/file/n3622769/ActiveMQClient.zip
ActiveMQClient.zip )

But after running the project I get the message only once. It doesn't come
to my solution twice, so it is never get acknowledged. I can see the
exception being thrown but listener doesn't receive the message second time.
I can't understand why the message is not get redelivered again.

What should I do if an exception is raised to force broker to send me the
message again? Should I create a new session or what? 

P.S. I am a newbie in ActiveMQ so the question might be a bit silly. The
link to a documentation chapter or to source example would be highly
appreciated.

--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-retry-messages-with-Individual-Acknowledge-mode-tp3622769p3622769.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.