You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by yesnid <ns...@pelco.com> on 2008/09/08 17:16:29 UTC

Multiple Consumers with REST

Hello All,

I am trying to have two consumers recieve messages from the same queue using
the rest interface to the ActiveMQ Broker, and am having issues where only
one of them can recieve messages at a time. The other consumer simply times
out indicating there are no messages in the queue even though I have
verified that there are. Am I doing something wrong?

Thank you.
-- 
View this message in context: http://www.nabble.com/Multiple-Consumers-with-REST-tp19374412p19374412.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multiple Consumers with REST

Posted by yesnid <ns...@pelco.com>.
Sweetness!, thank you for the help Dejan!

Dejan Bosanac-3 wrote:
> 
> Hi,
> 
> I've just tested and setting the message servler like this
> 
>     <servlet>
>         <servlet-name>MessageServlet</servlet-name>
>        
> <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>         <init-param>
>                 <param-name>destinationOptions</param-name>
>                 <param-value>consumer.prefetchSize=1</param-value>
>         </init-param>
>     </servlet>
> 
> in webapps/demo/WEB-INF/web.xml
> 
> should make a pretty even distribution of messages between clients.
> 
> As for explicit unsubscribing of REST consumers, I've made a JIRA
> enhacement request for that
> https://issues.apache.org/activemq/browse/AMQ-1933
> 
> Cheers
> 
> -- 
> Dejan Bosanac
> 
> 
> http://www.ttmsolutions.com - get a free ActiveMQ user guide
> 
> ActiveMQ in Action - http://www.manning.com/snyder/
> Scripting in Java - http://www.scriptinginjava.net
> 
> 
> 
> yesnid wrote:
>> Thank you for the help Dejan, I tried preset to one and I still have an
>> issue. If run each consumer and use the same JSESSIONID then they can all
>> consume, however If I have each one acquire a JSESSIONID, then they hang.
>> I
>> think it has to do with closing this session. Is there a way to
>> explicitly
>> close this as a client? Also is there a way to configure the time out for
>> this?
>>
>> Thank you,
>>  
>>
>> Dejan Bosanac-3 wrote:
>>   
>>> I think this could be a "prefetch size issue" meaning that all your
>>> messages are being sent to the first consumer. Try setting, prefetch
>>> size for you connection between rest servlet and broker
>>>
>>> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
>>>
>>> Cheers
>>>
>>> -- 
>>> Dejan Bosanac
>>>
>>>
>>> http://www.ttmsolutions.com - get a free ActiveMQ user guide
>>>
>>> ActiveMQ in Action - http://www.manning.com/snyder/
>>> Scripting in Java - http://www.scriptinginjava.net
>>>
>>>
>>>
>>> yesnid wrote:
>>>     
>>>> Hello All,
>>>>
>>>> I am trying to have two consumers recieve messages from the same queue
>>>> using
>>>> the rest interface to the ActiveMQ Broker, and am having issues where
>>>> only
>>>> one of them can recieve messages at a time. The other consumer simply
>>>> times
>>>> out indicating there are no messages in the queue even though I have
>>>> verified that there are. Am I doing something wrong?
>>>>
>>>> Thank you.
>>>>   
>>>>       
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-Consumers-with-REST-tp19374412p19436143.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multiple Consumers with REST

Posted by Dejan Bosanac <de...@ttmsolutions.com>.
Hi,

I've just tested and setting the message servler like this

    <servlet>
        <servlet-name>MessageServlet</servlet-name>
       
<servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>
                <param-name>destinationOptions</param-name>
                <param-value>consumer.prefetchSize=1</param-value>
        </init-param>
    </servlet>

in webapps/demo/WEB-INF/web.xml

should make a pretty even distribution of messages between clients.

As for explicit unsubscribing of REST consumers, I've made a JIRA
enhacement request for that
https://issues.apache.org/activemq/browse/AMQ-1933

Cheers

-- 
Dejan Bosanac


http://www.ttmsolutions.com - get a free ActiveMQ user guide

ActiveMQ in Action - http://www.manning.com/snyder/
Scripting in Java - http://www.scriptinginjava.net



yesnid wrote:
> Thank you for the help Dejan, I tried preset to one and I still have an
> issue. If run each consumer and use the same JSESSIONID then they can all
> consume, however If I have each one acquire a JSESSIONID, then they hang. I
> think it has to do with closing this session. Is there a way to explicitly
> close this as a client? Also is there a way to configure the time out for
> this?
>
> Thank you,
>  
>
> Dejan Bosanac-3 wrote:
>   
>> I think this could be a "prefetch size issue" meaning that all your
>> messages are being sent to the first consumer. Try setting, prefetch
>> size for you connection between rest servlet and broker
>>
>> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
>>
>> Cheers
>>
>> -- 
>> Dejan Bosanac
>>
>>
>> http://www.ttmsolutions.com - get a free ActiveMQ user guide
>>
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Scripting in Java - http://www.scriptinginjava.net
>>
>>
>>
>> yesnid wrote:
>>     
>>> Hello All,
>>>
>>> I am trying to have two consumers recieve messages from the same queue
>>> using
>>> the rest interface to the ActiveMQ Broker, and am having issues where
>>> only
>>> one of them can recieve messages at a time. The other consumer simply
>>> times
>>> out indicating there are no messages in the queue even though I have
>>> verified that there are. Am I doing something wrong?
>>>
>>> Thank you.
>>>   
>>>       
>>
>>
>>     
>
>   



Re: Multiple Consumers with REST

Posted by yesnid <ns...@pelco.com>.
Thank you for the help Dejan, I tried preset to one and I still have an
issue. If run each consumer and use the same JSESSIONID then they can all
consume, however If I have each one acquire a JSESSIONID, then they hang. I
think it has to do with closing this session. Is there a way to explicitly
close this as a client? Also is there a way to configure the time out for
this?

Thank you,
 

Dejan Bosanac-3 wrote:
> 
> I think this could be a "prefetch size issue" meaning that all your
> messages are being sent to the first consumer. Try setting, prefetch
> size for you connection between rest servlet and broker
> 
> http://activemq.apache.org/what-is-the-prefetch-limit-for.html
> 
> Cheers
> 
> -- 
> Dejan Bosanac
> 
> 
> http://www.ttmsolutions.com - get a free ActiveMQ user guide
> 
> ActiveMQ in Action - http://www.manning.com/snyder/
> Scripting in Java - http://www.scriptinginjava.net
> 
> 
> 
> yesnid wrote:
>> Hello All,
>>
>> I am trying to have two consumers recieve messages from the same queue
>> using
>> the rest interface to the ActiveMQ Broker, and am having issues where
>> only
>> one of them can recieve messages at a time. The other consumer simply
>> times
>> out indicating there are no messages in the queue even though I have
>> verified that there are. Am I doing something wrong?
>>
>> Thank you.
>>   
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-Consumers-with-REST-tp19374412p19402730.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Multiple Consumers with REST

Posted by Dejan Bosanac <de...@ttmsolutions.com>.
I think this could be a "prefetch size issue" meaning that all your
messages are being sent to the first consumer. Try setting, prefetch
size for you connection between rest servlet and broker

http://activemq.apache.org/what-is-the-prefetch-limit-for.html

Cheers

-- 
Dejan Bosanac


http://www.ttmsolutions.com - get a free ActiveMQ user guide

ActiveMQ in Action - http://www.manning.com/snyder/
Scripting in Java - http://www.scriptinginjava.net



yesnid wrote:
> Hello All,
>
> I am trying to have two consumers recieve messages from the same queue using
> the rest interface to the ActiveMQ Broker, and am having issues where only
> one of them can recieve messages at a time. The other consumer simply times
> out indicating there are no messages in the queue even though I have
> verified that there are. Am I doing something wrong?
>
> Thank you.
>