|
I want to set the timeout period for the Acknowledge i.e. if the acknowledge is not received for the particular message from consumer within a time period then, the broker should resend the message to the consumer.
For this purpose should we set the initialRedeliveryDelay field or redeliveryDelay field????? Sorry if the question sounds silly. Its just that the documentation does say much about it. Thanks |
|
There is no support for this with the redelivery policy. jms is
connection oriented, so the assumption is that if the connection is alive and there is no ack, the consumer has a good reason not to ack yet. The only way to force the broker to redeliver is to close the consumer. One way to achieve this is to have the consumers connection timeout if it is inactive for some period. The inactivity monitor, without keepAlive messages will do this for you. use a broker url of <host:port>?useKeepAlive=false&wireFormat.maxInactivityDuration=20000 and that will terminate the connection after 20 seconds of inactivity which will force the broker to redispatch the message. On 4 April 2012 06:51, oBanawalikar <[hidden email]> wrote: > I want to set the timeout period for the Acknowledge i.e. if the acknowledge > is not received for the particular message from consumer within a time > period then, the broker should resend the message to the consumer. > For this purpose should we set the /initialRedeliveryDelay/ field or > /redeliveryDelay/ field????? > > Sorry if the question sounds silly. Its just that the documentation does say > much about it. > > Thanks > > -- > View this message in context: http://activemq.2283324.n4.nabble.com/Acknowledgement-Timeout-tp4531016p4531016.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. -- http://fusesource.com http://blog.garytully.com |
|
Another alternative to killing the connection is to use the
slowConsumerStrategy destination policy[1], a consumer that does not ack is considered slow, if this persists for a period, the AbortSlowConsumerStrategy can terminate the consumer and inflight messages will get dispatched. I think terminating the consumer is the only way to be sure there is no duplicate dispatch. If the consumers remain, you could have a case where each consumer gets a copy of the message, essentially turing a queue into a topic. There was a discussion on this at https://issues.apache.org/jira/browse/AMQ-3394 [1] http://activemq.apache.org/per-destination-policies.html On 4 April 2012 12:41, Gary Tully <[hidden email]> wrote: > There is no support for this with the redelivery policy. jms is > connection oriented, so the assumption is that if the connection is > alive and there is no ack, the consumer has a good reason not to ack > yet. > > The only way to force the broker to redeliver is to close the consumer. > One way to achieve this is to have the consumers connection timeout if > it is inactive for some period. > > The inactivity monitor, without keepAlive messages will do this for you. > > use a broker url of > <host:port>?useKeepAlive=false&wireFormat.maxInactivityDuration=20000 > > and that will terminate the connection after 20 seconds of inactivity > which will force the broker to redispatch the message. > > > On 4 April 2012 06:51, oBanawalikar <[hidden email]> wrote: >> I want to set the timeout period for the Acknowledge i.e. if the acknowledge >> is not received for the particular message from consumer within a time >> period then, the broker should resend the message to the consumer. >> For this purpose should we set the /initialRedeliveryDelay/ field or >> /redeliveryDelay/ field????? >> >> Sorry if the question sounds silly. Its just that the documentation does say >> much about it. >> >> Thanks >> >> -- >> View this message in context: http://activemq.2283324.n4.nabble.com/Acknowledgement-Timeout-tp4531016p4531016.html >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > > > -- > http://fusesource.com > http://blog.garytully.com -- http://fusesource.com http://blog.garytully.com |
|
This post has NOT been accepted by the mailing list yet.
I think we can even use the session.recover() method to force broker to dispatched the unacknowledged messages. In my example I am using just one consumer that is accepting the messages, then processing it( this is a time consuming job) and then acknowledging it.
Since the processing is a time consuming job and the messages which I sent have a temporal importance so, I have to store the messages received by the consumer till its processing is complete. And I am calling the recover() after regular intervals so that the unacknowledged messages gets first priority while dispatching. But the problem now is after calling acknowledge() on certain message it results into 'Could not correlate acknowledgment with dispatched message:' exception. It is because the acknowledged message and the message in the broker are different. How do I rectify this Exception?? |
| Powered by Nabble | Edit this page |
