activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <>
Subject Re: how to best implement a producer timeout
Date Thu, 11 Dec 2008 06:05:21 GMT

On 11 Dec 2008, at 01:38, emc2family wrote:

> Hi,
> when a broker starts to block producers as a result of producer flow
> control, is there an elegant way for a producer to timeout as a  
> result of
> this?  i was thinking of setting the message's timetolive to achieve  
> this.
> i suppose i could also use maxinactivityduration.  i think both will  
> throw a
> jmsexception.  which leads me to my next question.  is there a  
> specific
> error code for a timetolive or maxinactivityduration exceptions?   
> thanks a
> bunch.
> -- 
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

Not elegant - but one of these - if you are sending with default  
delivery mode (PERSISTENT):

When you create your MessageProducer - cast it to an  
org.apache.activemq.ActiveMQMessageProducer and set it via the  
setSendTimeout(int ) method

set the sendTimeout property on the ActiveMQConnection

or set the sendTimeout on the ActiveMQConnectionFactory - either  
directly or via a property

or my favourite:

Set the sendTimeout as a property on the destination used to create  
the producer - e.g. if you want to send on a Topic called "foo" - call

Destination dest= session.createTopic("foo?producer.sendTimeout="5000");
MessageProducer producer = session.createProducer(dest);



Rob Davies

View raw message