On Fri, Mar 6, 2015 at 8:37 AM, arun196 <arun.bi...@gmail.com> wrote: > I have a consumer that processes orders from messages received from activemq. > I would like to set a timeout in case the order processing takes over 5 > minutes.
I'm sorry, it's not clear to me from your description what it is that you are intending to effect with the timeout. Is the concern that the consumer has "gone away," and won't ever ack the message? Or that the consumer is really really slow, but still working? Is it possible that, if one waits long enough, that this 5+ minute message will finally be processed? Are you using transactions to handle the fetch/process/ack cycle? I would think that would be one typical way to handle the problem, but your client has to handle the logic of deciding whether or not it can finally ack a message. http://www.javaworld.com/article/2074123/java-web-development/transaction-and-redelivery-in-jms.html http://activemq.apache.org/should-i-use-transactions.html http://activemq.apache.org/should-i-use-xa.html http://activemq.apache.org/redelivery-policy.html Looking around, I see that back in 5.9 the ActiveMQ folks introduced a broker-side configuration called abortSlowConsumerStrategy I'm not sure whether or not it's still active code, but here's an article discussing it when it was released: http://timbish.blogspot.com/2013/07/coming-in-activemq-59-new-way-to-abort.html If that's still available, it might be a way to force a timeout and redelivery if you know that the consumer has actually failed if it takes longer than specified time. Jim