You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Leen Toelen <to...@gmail.com> on 2010/03/24 12:16:31 UTC

JMS send Timeout

Hi,

I have an HTTP endpoint that submits messages to an ActiveMQ queue.
When the consumer gets slow, the Queue is throttled and the HTTP call
hangs infinitely. Is there a way to tell the broker that if a JMS
message is not accepted within a timeout, the exchange is interrupted
and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
but that does not seem to do what I expected.

HttpEndpoint httpEndpoint = (HttpEndpoint)
endpoint("jetty:http://0.0.0.0:8162/queue");

JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
topic.setReceiveTimeout(5000);
topic.setRequestTimeout(5000);
		
from(httpEndpoint).inOnly(topic);

Regards,
Leen

Re: JMS send Timeout

Posted by Leen Toelen <to...@gmail.com>.
Yes, that is what I would like to achieve. When the queue cannot accept a
message immediately the producer should receive an error and retry later. My
problem is that the producer is a critical single threaded process (and out
of my control) and should never be blocked. This parameter helps in some
circumstances.

Regards,
Leen

On Thu, Mar 25, 2010 at 10:38 AM, Charles Moulliard <cm...@gmail.com>wrote:

> Hi Leen,
>
> From my understanding, this parameter "sendFailIfNoSpace" of ActiveMq will
> send back to the producer an error message when we have slow consumers and
> if memory usage is reached.
>
> See here for an explanation :
>
> http://blog.garytully.com/2009/01/activemq-systemusage-xml-configuration.html
>
> Kind regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>
> On Thu, Mar 25, 2010 at 10:26 AM, Leen Toelen <to...@gmail.com> wrote:
>
> > Hi,
> >
> > to answer my own question. I managed to do what I wanted by setting this
> > parameter in activemq.xml
> >
> >       <systemUsage>
> >           <systemUsage *sendFailIfNoSpace="true"*>
> >               <memoryUsage>
> >                   <memoryUsage limit="100 mb"/>
> >               </memoryUsage>
> >               <storeUsage>
> >                   <storeUsage limit="1 gb" name="foo"/>
> >               </storeUsage>
> >               <tempUsage>
> >                   <tempUsage limit="500 mb"/>
> >               </tempUsage>
> >           </systemUsage>
> >       </systemUsage>
> >
> > In ActiveMQ 5.3.1 this is going to be improved by also allowing you to
> set
> > a
> > timeout parameter.
> >
> > This sends an error to the producer as soon as the queue is being
> > throttled.
> > This is not advisable in all situations of course, but in mine this is
> > exactly what I need.
> >
> > Regards,
> > Leen
> >
> > On Wed, Mar 24, 2010 at 3:34 PM, Claus Ibsen <cl...@gmail.com>
> > wrote:
> > > On Wed, Mar 24, 2010 at 3:31 PM, Leen Toelen <to...@gmail.com> wrote:
> > >> Hi,
> > >>
> > >> what I would like as a result is that the HTTP generates a 200 OK as
> > >> soon as possible, and if the ActiveMQ queue is being throttled I
> > >> generate a 503 Service Temporarily Unavailable.
> > >>
> > >
> > > You have to ask at AMQ forum as its about its connection which can
> > > live reconnect and whatnot.
> > > There are some options you can set to adjust for that.
> > >
> > > Also something about sendAsync=false to have it return with fail
> > > faster. But all those options and whatnot is what the AMQ people know
> > > about.
> > >
> > >
> > >> Regards,
> > >> Leen
> > >>
> > >> On Wed, Mar 24, 2010 at 12:23 PM, Charles Moulliard
> > >> <cm...@gmail.com> wrote:
> > >>> Maybe, you should consider to use an async route :
> > >>> http://camel.apache.org/asynchronous-processing.html
> > >>>
> > >>> Kind regards,
> > >>>
> > >>> Charles Moulliard
> > >>> Senior Enterprise Architect
> > >>> Apache Camel Committer
> > >>>
> > >>> *****************************
> > >>> blog : http://cmoulliard.blogspot.com
> > >>> twitter : http://twitter.com/cmoulliard
> > >>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> > >>>
> > >>> Apache Camel Group :
> > >>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> > >>>
> > >>>
> > >>> On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com>
> > wrote:
> > >>>
> > >>>> Hi,
> > >>>>
> > >>>> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
> > >>>> When the consumer gets slow, the Queue is throttled and the HTTP
> call
> > >>>> hangs infinitely. Is there a way to tell the broker that if a JMS
> > >>>> message is not accepted within a timeout, the exchange is
> interrupted
> > >>>> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
> > >>>> but that does not seem to do what I expected.
> > >>>>
> > >>>> HttpEndpoint httpEndpoint = (HttpEndpoint)
> > >>>> endpoint("jetty:http://0.0.0.0:8162/queue");
> > >>>>
> > >>>> JmsEndpoint topic = (JmsEndpoint)
> endpoint("activemq:topic:MyTopic");
> > >>>> topic.setReceiveTimeout(5000);
> > >>>> topic.setRequestTimeout(5000);
> > >>>>
> > >>>> from(httpEndpoint).inOnly(topic);
> > >>>>
> > >>>> Regards,
> > >>>> Leen
> > >>>>
> > >>>
> > >>
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > Apache Camel Committer
> > >
> > > Author of Camel in Action: http://www.manning.com/ibsen/
> > > Open Source Integration: http://fusesource.com
> > > Blog: http://davsclaus.blogspot.com/
> > > Twitter: http://twitter.com/davsclaus
> > >
> >
>

Re: JMS send Timeout

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Leen,

>From my understanding, this parameter "sendFailIfNoSpace" of ActiveMq will
send back to the producer an error message when we have slow consumers and
if memory usage is reached.

See here for an explanation :
http://blog.garytully.com/2009/01/activemq-systemusage-xml-configuration.html

Kind regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Thu, Mar 25, 2010 at 10:26 AM, Leen Toelen <to...@gmail.com> wrote:

> Hi,
>
> to answer my own question. I managed to do what I wanted by setting this
> parameter in activemq.xml
>
>       <systemUsage>
>           <systemUsage *sendFailIfNoSpace="true"*>
>               <memoryUsage>
>                   <memoryUsage limit="100 mb"/>
>               </memoryUsage>
>               <storeUsage>
>                   <storeUsage limit="1 gb" name="foo"/>
>               </storeUsage>
>               <tempUsage>
>                   <tempUsage limit="500 mb"/>
>               </tempUsage>
>           </systemUsage>
>       </systemUsage>
>
> In ActiveMQ 5.3.1 this is going to be improved by also allowing you to set
> a
> timeout parameter.
>
> This sends an error to the producer as soon as the queue is being
> throttled.
> This is not advisable in all situations of course, but in mine this is
> exactly what I need.
>
> Regards,
> Leen
>
> On Wed, Mar 24, 2010 at 3:34 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> > On Wed, Mar 24, 2010 at 3:31 PM, Leen Toelen <to...@gmail.com> wrote:
> >> Hi,
> >>
> >> what I would like as a result is that the HTTP generates a 200 OK as
> >> soon as possible, and if the ActiveMQ queue is being throttled I
> >> generate a 503 Service Temporarily Unavailable.
> >>
> >
> > You have to ask at AMQ forum as its about its connection which can
> > live reconnect and whatnot.
> > There are some options you can set to adjust for that.
> >
> > Also something about sendAsync=false to have it return with fail
> > faster. But all those options and whatnot is what the AMQ people know
> > about.
> >
> >
> >> Regards,
> >> Leen
> >>
> >> On Wed, Mar 24, 2010 at 12:23 PM, Charles Moulliard
> >> <cm...@gmail.com> wrote:
> >>> Maybe, you should consider to use an async route :
> >>> http://camel.apache.org/asynchronous-processing.html
> >>>
> >>> Kind regards,
> >>>
> >>> Charles Moulliard
> >>> Senior Enterprise Architect
> >>> Apache Camel Committer
> >>>
> >>> *****************************
> >>> blog : http://cmoulliard.blogspot.com
> >>> twitter : http://twitter.com/cmoulliard
> >>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> >>>
> >>> Apache Camel Group :
> >>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
> >>>
> >>>
> >>> On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com>
> wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
> >>>> When the consumer gets slow, the Queue is throttled and the HTTP call
> >>>> hangs infinitely. Is there a way to tell the broker that if a JMS
> >>>> message is not accepted within a timeout, the exchange is interrupted
> >>>> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
> >>>> but that does not seem to do what I expected.
> >>>>
> >>>> HttpEndpoint httpEndpoint = (HttpEndpoint)
> >>>> endpoint("jetty:http://0.0.0.0:8162/queue");
> >>>>
> >>>> JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
> >>>> topic.setReceiveTimeout(5000);
> >>>> topic.setRequestTimeout(5000);
> >>>>
> >>>> from(httpEndpoint).inOnly(topic);
> >>>>
> >>>> Regards,
> >>>> Leen
> >>>>
> >>>
> >>
> >
> >
> >
> > --
> > Claus Ibsen
> > Apache Camel Committer
> >
> > Author of Camel in Action: http://www.manning.com/ibsen/
> > Open Source Integration: http://fusesource.com
> > Blog: http://davsclaus.blogspot.com/
> > Twitter: http://twitter.com/davsclaus
> >
>

Re: JMS send Timeout

Posted by Leen Toelen <to...@gmail.com>.
Hi,

to answer my own question. I managed to do what I wanted by setting this
parameter in activemq.xml

       <systemUsage>
           <systemUsage *sendFailIfNoSpace="true"*>
               <memoryUsage>
                   <memoryUsage limit="100 mb"/>
               </memoryUsage>
               <storeUsage>
                   <storeUsage limit="1 gb" name="foo"/>
               </storeUsage>
               <tempUsage>
                   <tempUsage limit="500 mb"/>
               </tempUsage>
           </systemUsage>
       </systemUsage>

In ActiveMQ 5.3.1 this is going to be improved by also allowing you to set a
timeout parameter.

This sends an error to the producer as soon as the queue is being throttled.
This is not advisable in all situations of course, but in mine this is
exactly what I need.

Regards,
Leen

On Wed, Mar 24, 2010 at 3:34 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Mar 24, 2010 at 3:31 PM, Leen Toelen <to...@gmail.com> wrote:
>> Hi,
>>
>> what I would like as a result is that the HTTP generates a 200 OK as
>> soon as possible, and if the ActiveMQ queue is being throttled I
>> generate a 503 Service Temporarily Unavailable.
>>
>
> You have to ask at AMQ forum as its about its connection which can
> live reconnect and whatnot.
> There are some options you can set to adjust for that.
>
> Also something about sendAsync=false to have it return with fail
> faster. But all those options and whatnot is what the AMQ people know
> about.
>
>
>> Regards,
>> Leen
>>
>> On Wed, Mar 24, 2010 at 12:23 PM, Charles Moulliard
>> <cm...@gmail.com> wrote:
>>> Maybe, you should consider to use an async route :
>>> http://camel.apache.org/asynchronous-processing.html
>>>
>>> Kind regards,
>>>
>>> Charles Moulliard
>>> Senior Enterprise Architect
>>> Apache Camel Committer
>>>
>>> *****************************
>>> blog : http://cmoulliard.blogspot.com
>>> twitter : http://twitter.com/cmoulliard
>>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>>
>>> Apache Camel Group :
>>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>>
>>>
>>> On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
>>>> When the consumer gets slow, the Queue is throttled and the HTTP call
>>>> hangs infinitely. Is there a way to tell the broker that if a JMS
>>>> message is not accepted within a timeout, the exchange is interrupted
>>>> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
>>>> but that does not seem to do what I expected.
>>>>
>>>> HttpEndpoint httpEndpoint = (HttpEndpoint)
>>>> endpoint("jetty:http://0.0.0.0:8162/queue");
>>>>
>>>> JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
>>>> topic.setReceiveTimeout(5000);
>>>> topic.setRequestTimeout(5000);
>>>>
>>>> from(httpEndpoint).inOnly(topic);
>>>>
>>>> Regards,
>>>> Leen
>>>>
>>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: JMS send Timeout

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 24, 2010 at 3:31 PM, Leen Toelen <to...@gmail.com> wrote:
> Hi,
>
> what I would like as a result is that the HTTP generates a 200 OK as
> soon as possible, and if the ActiveMQ queue is being throttled I
> generate a 503 Service Temporarily Unavailable.
>

You have to ask at AMQ forum as its about its connection which can
live reconnect and whatnot.
There are some options you can set to adjust for that.

Also something about sendAsync=false to have it return with fail
faster. But all those options and whatnot is what the AMQ people know
about.


> Regards,
> Leen
>
> On Wed, Mar 24, 2010 at 12:23 PM, Charles Moulliard
> <cm...@gmail.com> wrote:
>> Maybe, you should consider to use an async route :
>> http://camel.apache.org/asynchronous-processing.html
>>
>> Kind regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>> On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
>>> When the consumer gets slow, the Queue is throttled and the HTTP call
>>> hangs infinitely. Is there a way to tell the broker that if a JMS
>>> message is not accepted within a timeout, the exchange is interrupted
>>> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
>>> but that does not seem to do what I expected.
>>>
>>> HttpEndpoint httpEndpoint = (HttpEndpoint)
>>> endpoint("jetty:http://0.0.0.0:8162/queue");
>>>
>>> JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
>>> topic.setReceiveTimeout(5000);
>>> topic.setRequestTimeout(5000);
>>>
>>> from(httpEndpoint).inOnly(topic);
>>>
>>> Regards,
>>> Leen
>>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: JMS send Timeout

Posted by Leen Toelen <to...@gmail.com>.
Hi,

what I would like as a result is that the HTTP generates a 200 OK as
soon as possible, and if the ActiveMQ queue is being throttled I
generate a 503 Service Temporarily Unavailable.

Regards,
Leen

On Wed, Mar 24, 2010 at 12:23 PM, Charles Moulliard
<cm...@gmail.com> wrote:
> Maybe, you should consider to use an async route :
> http://camel.apache.org/asynchronous-processing.html
>
> Kind regards,
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
> twitter : http://twitter.com/cmoulliard
> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>
> Apache Camel Group :
> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>
>
> On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com> wrote:
>
>> Hi,
>>
>> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
>> When the consumer gets slow, the Queue is throttled and the HTTP call
>> hangs infinitely. Is there a way to tell the broker that if a JMS
>> message is not accepted within a timeout, the exchange is interrupted
>> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
>> but that does not seem to do what I expected.
>>
>> HttpEndpoint httpEndpoint = (HttpEndpoint)
>> endpoint("jetty:http://0.0.0.0:8162/queue");
>>
>> JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
>> topic.setReceiveTimeout(5000);
>> topic.setRequestTimeout(5000);
>>
>> from(httpEndpoint).inOnly(topic);
>>
>> Regards,
>> Leen
>>
>

Re: JMS send Timeout

Posted by Charles Moulliard <cm...@gmail.com>.
Maybe, you should consider to use an async route :
http://camel.apache.org/asynchronous-processing.html

Kind regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Mar 24, 2010 at 12:16 PM, Leen Toelen <to...@gmail.com> wrote:

> Hi,
>
> I have an HTTP endpoint that submits messages to an ActiveMQ queue.
> When the consumer gets slow, the Queue is throttled and the HTTP call
> hangs infinitely. Is there a way to tell the broker that if a JMS
> message is not accepted within a timeout, the exchange is interrupted
> and the HTTP endpoint returns an HTTP error? I tried RequestTimeout
> but that does not seem to do what I expected.
>
> HttpEndpoint httpEndpoint = (HttpEndpoint)
> endpoint("jetty:http://0.0.0.0:8162/queue");
>
> JmsEndpoint topic = (JmsEndpoint) endpoint("activemq:topic:MyTopic");
> topic.setReceiveTimeout(5000);
> topic.setRequestTimeout(5000);
>
> from(httpEndpoint).inOnly(topic);
>
> Regards,
> Leen
>