You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by emc2family <em...@gmail.com> on 2008/12/11 02:38:45 UTC
how to best implement a producer timeout
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.
Re: how to best implement a producer timeout
Posted by Rob Davies <ra...@gmail.com>.
On 11 Dec 2008, at 06:34, PankajGugnani wrote:
>
> Hi rajdavies,
>
> Thanks for the quick reply.
> In my project, I want to throw an exception if timeout occured. But
> for
> this, I need to know what happened to the message. Is it published
> or is it
> discarded. And also, is there way by which I can get an
> acknowledgement of
> what happend to the message(like added to the queue or discarded)
>
You might be better off using advisories to achieve what you need. The
publishing is decoupled from the dispatch of the message - see:
http://activemq.apache.org/advisory-message.html for 5.2. There needs
to be some better documentation around that - so you can grok how to
configure them - will try remember to do that when I'm not on vacation
(and the wife has just woken up - so I'm in trouble working on my day
off :))
> rajdavies wrote:
>>
>>
>> On 11 Dec 2008, at 06:08, PankajGugnani wrote:
>>
>>>
>>> Hi,
>>>
>>> can u please explain the behaviou in this particular case after the
>>> TimeOut.
>>> will there be an exception thrown if the timeout occurs.
>>>
>>> Thanks in advance
>>>
>>> rajdavies wrote:
>>
>> Not currently - I'm afraid there's no difference between a successful
>> send and a request that timed out - perhaps someone should raise a
>> jira for that one ?
>>>
>>>>
>>>>
>>>> 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/
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20949967.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20950155.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Re: how to best implement a producer timeout
Posted by PankajGugnani <pa...@yahoo.co.in>.
Hi rajdavies,
Thanks for the quick reply.
In my project, I want to throw an exception if timeout occured. But for
this, I need to know what happened to the message. Is it published or is it
discarded. And also, is there way by which I can get an acknowledgement of
what happend to the message(like added to the queue or discarded)
rajdavies wrote:
>
>
> On 11 Dec 2008, at 06:08, PankajGugnani wrote:
>
>>
>> Hi,
>>
>> can u please explain the behaviou in this particular case after the
>> TimeOut.
>> will there be an exception thrown if the timeout occurs.
>>
>> Thanks in advance
>>
>> rajdavies wrote:
>
> Not currently - I'm afraid there's no difference between a successful
> send and a request that timed out - perhaps someone should raise a
> jira for that one ?
>>
>>>
>>>
>>> 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/
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20949967.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>
>
--
View this message in context: http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20950155.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how to best implement a producer timeout
Posted by Rob Davies <ra...@gmail.com>.
On 11 Dec 2008, at 06:08, PankajGugnani wrote:
>
> Hi,
>
> can u please explain the behaviou in this particular case after the
> TimeOut.
> will there be an exception thrown if the timeout occurs.
>
> Thanks in advance
>
> rajdavies wrote:
Not currently - I'm afraid there's no difference between a successful
send and a request that timed out - perhaps someone should raise a
jira for that one ?
>
>>
>>
>> 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/
>>
>>
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20949967.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Re: how to best implement a producer timeout
Posted by PankajGugnani <pa...@yahoo.co.in>.
Hi,
can u please explain the behaviou in this particular case after the TimeOut.
will there be an exception thrown if the timeout occurs.
Thanks in advance
rajdavies wrote:
>
>
> 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/
>
>
>
>
>
>
>
>
--
View this message in context: http://www.nabble.com/how-to-best-implement-a-producer-timeout-tp20947923p20949967.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: how to best implement a producer timeout
Posted by Rob Davies <ra...@gmail.com>.
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/