You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by lokem <fu...@yahoo.com> on 2010/06/22 18:23:59 UTC
HTTP 204 when consuming messages via REST servlet
Hi folks,
I'm using MessageServlet in ActiveMQ 5.3.1's demo webapp. Placing a message
via POST works fine. However, when consuming it via GET or DELETE, the
servlet returns either a HTTP 200 OK with the proper message or HTTP 204 No
Content. I've tried adding the parameter value "consumer.prefetchSize=1" as
well as re-using the same session cookie; but the behavior is still the
same.
I have 10 messages in the queue which I'm trying to consume from. Usually
the first GET/DELETE request returns the proper message (HTTP 200) while the
subsequent retries end up with HTTP 204 responses.
Here's the URL I usually use:
curl -X GET
"http://localhost:8161/demo/message/OUTGOING_QUEUE?readTimeout=500&type=queue"
Any help is greatly appreciated.
Thanks.
--
View this message in context: http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28962212.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: HTTP 204 when consuming messages via REST servlet
Posted by lokem <fu...@yahoo.com>.
I should mention that I'm using AMQ 5.3.x and the method described in
http://activemq.apache.org/rest.html#REST-Consumingwithselectors doesn't
apply :(
Thanks.
lokem wrote:
>
> Hi,
>
> Thanks for the pointer. It's working now without returning any 204
> response. Is it possible to retrieve a message via REST by specifying the
> message JMSCorrelationID?
>
>
> Thanks.
>
>
> Dejan Bosanac wrote:
>>
>> Hi,
>>
>> this just means that your session is not reused between calls. Take a
>> look
>> at this example:
>>
>> cd examples
>> ant producer -Dmax=10
>>
>>
>> wget -O - --save-cookies cookies.txt --load-cookies cookies.txt
>> --keep-session-cookies
>> http://localhost:8161/demo/message/TEST.FOO?type=queue
>>
>> will get all messages
>>
>> if you don't want to use sessions, you can pass additional clientId
>> parameter to always use the same consumer. Take a look at
>> https://issues.apache.org/activemq/browse/AMQ-1960 for more information
>>
>> Cheers
>> --
>> Dejan Bosanac - http://twitter.com/dejanb
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>>
>> On Tue, Jun 22, 2010 at 6:23 PM, lokem <fu...@yahoo.com> wrote:
>>
>>>
>>> Hi folks,
>>>
>>> I'm using MessageServlet in ActiveMQ 5.3.1's demo webapp. Placing a
>>> message
>>> via POST works fine. However, when consuming it via GET or DELETE, the
>>> servlet returns either a HTTP 200 OK with the proper message or HTTP 204
>>> No
>>> Content. I've tried adding the parameter value
>>> "consumer.prefetchSize=1"
>>> as
>>> well as re-using the same session cookie; but the behavior is still the
>>> same.
>>>
>>> I have 10 messages in the queue which I'm trying to consume from.
>>> Usually
>>> the first GET/DELETE request returns the proper message (HTTP 200) while
>>> the
>>> subsequent retries end up with HTTP 204 responses.
>>>
>>> Here's the URL I usually use:
>>>
>>> curl -X GET
>>> "
>>> http://localhost:8161/demo/message/OUTGOING_QUEUE?readTimeout=500&type=queue
>>> "
>>>
>>> Any help is greatly appreciated.
>>>
>>>
>>>
>>> Thanks.
>>> --
>>> View this message in context:
>>> http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28962212.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> Dejan Bosanac
>>
>> Open Source Integration - http://fusesource.com/
>> ActiveMQ in Action - http://www.manning.com/snyder/
>> Blog - http://www.nighttale.net
>>
>
>
--
View this message in context: http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28992003.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: HTTP 204 when consuming messages via REST servlet
Posted by lokem <fu...@yahoo.com>.
Hi,
Thanks for the pointer. It's working now without returning any 204
response. Is it possible to retrieve a message via REST by specifying the
message JMSCorrelationID?
Thanks.
Dejan Bosanac wrote:
>
> Hi,
>
> this just means that your session is not reused between calls. Take a look
> at this example:
>
> cd examples
> ant producer -Dmax=10
>
>
> wget -O - --save-cookies cookies.txt --load-cookies cookies.txt
> --keep-session-cookies
> http://localhost:8161/demo/message/TEST.FOO?type=queue
>
> will get all messages
>
> if you don't want to use sessions, you can pass additional clientId
> parameter to always use the same consumer. Take a look at
> https://issues.apache.org/activemq/browse/AMQ-1960 for more information
>
> Cheers
> --
> Dejan Bosanac - http://twitter.com/dejanb
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Tue, Jun 22, 2010 at 6:23 PM, lokem <fu...@yahoo.com> wrote:
>
>>
>> Hi folks,
>>
>> I'm using MessageServlet in ActiveMQ 5.3.1's demo webapp. Placing a
>> message
>> via POST works fine. However, when consuming it via GET or DELETE, the
>> servlet returns either a HTTP 200 OK with the proper message or HTTP 204
>> No
>> Content. I've tried adding the parameter value "consumer.prefetchSize=1"
>> as
>> well as re-using the same session cookie; but the behavior is still the
>> same.
>>
>> I have 10 messages in the queue which I'm trying to consume from.
>> Usually
>> the first GET/DELETE request returns the proper message (HTTP 200) while
>> the
>> subsequent retries end up with HTTP 204 responses.
>>
>> Here's the URL I usually use:
>>
>> curl -X GET
>> "
>> http://localhost:8161/demo/message/OUTGOING_QUEUE?readTimeout=500&type=queue
>> "
>>
>> Any help is greatly appreciated.
>>
>>
>>
>> Thanks.
>> --
>> View this message in context:
>> http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28962212.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
>
>
> -----
> Dejan Bosanac
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
--
View this message in context: http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28990228.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: HTTP 204 when consuming messages via REST servlet
Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,
this just means that your session is not reused between calls. Take a look
at this example:
cd examples
ant producer -Dmax=10
wget -O - --save-cookies cookies.txt --load-cookies cookies.txt
--keep-session-cookies
http://localhost:8161/demo/message/TEST.FOO?type=queue
will get all messages
if you don't want to use sessions, you can pass additional clientId
parameter to always use the same consumer. Take a look at
https://issues.apache.org/activemq/browse/AMQ-1960 for more information
Cheers
--
Dejan Bosanac - http://twitter.com/dejanb
Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Tue, Jun 22, 2010 at 6:23 PM, lokem <fu...@yahoo.com> wrote:
>
> Hi folks,
>
> I'm using MessageServlet in ActiveMQ 5.3.1's demo webapp. Placing a
> message
> via POST works fine. However, when consuming it via GET or DELETE, the
> servlet returns either a HTTP 200 OK with the proper message or HTTP 204 No
> Content. I've tried adding the parameter value "consumer.prefetchSize=1"
> as
> well as re-using the same session cookie; but the behavior is still the
> same.
>
> I have 10 messages in the queue which I'm trying to consume from. Usually
> the first GET/DELETE request returns the proper message (HTTP 200) while
> the
> subsequent retries end up with HTTP 204 responses.
>
> Here's the URL I usually use:
>
> curl -X GET
> "
> http://localhost:8161/demo/message/OUTGOING_QUEUE?readTimeout=500&type=queue
> "
>
> Any help is greatly appreciated.
>
>
>
> Thanks.
> --
> View this message in context:
> http://old.nabble.com/HTTP-204-when-consuming-messages-via-REST-servlet-tp28962212p28962212.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>