activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
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: http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20947923.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

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
or


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);



cheers,

Rob

Rob Davies
http://fusesource.com
http://rajdavies.blogspot.com/







Mime
View raw message