activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dejan Bosanac <dejan.bosa...@ttmsolutions.com>
Subject Re: REST: eternal HTTP status 204
Date Fri, 05 Sep 2008 11:09:18 GMT
The problem is that you have to keep your HTTP session between your GET
requests. So, try something like

wget --save-cookies cookies.txt --load-cookies cookies.txt
--keep-session-cookies  http://localhost:8161/demo/message/TEST1?type=queue

if you're playing with wget, or something similar in your scripting code
(or just use Stomp ;))

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:
> I am having the same issue, what is the solution?
>
> sv75 wrote:
>   
>> I'm trying simple python program to using ActiveMQ via HTTP.
>> I managed to send message via HTTP/POST, but have problems getting them
>> via GET (or DELETE). While first request receive message (with HTTP status
>> 200), all other requests has status 204 (not modified?) and no body after
>> long delay (~5 seconds). It start working after restaring amq - but only
>> one message again. What I'm doing wrong? Any advices, please? I see the
>> same behavior with web browser when using "send/recieve message" in demo
>> so i don't think it is my program.
>>
>> I tried 4.1.1 and 5.0 snapshots - same behavior. And using web browser JDK
>> 1.6, Ubuntu 7.04. amq working under root.
>>
>> =====
>> #!/usr/bin/python
>> import httplib2
>> import urllib
>> from time import *
>>
>> BASE = "http://localhost:8161/demo/" # AMQ 5.0
>> # BASE = "http://localhost:8080/activemq-web-demo/" # AMQ 4.1
>> client = httplib2.Http()
>> dtype = "queue"
>>
>> def SendMessage(queue, body):
>>     url = BASE + "message/" +  queue
>>     print "[%s] -> %s" % (body, url) # "destination": queue,
>>     body = urllib.urlencode({"type": dtype, "body" : body})
>>     return client.request(url, "POST", body,
>>         headers={"Content-type": "application/x-www-form-urlencoded"})
>>
>> def GetMessage(queue, method):
>>     url = BASE + "message/" + queue + "?" + urllib.urlencode({"type":
>> dtype, "timeout": 1})
>>     print url,'->'
>>     headers, body = client.request(url, method, None, None)
>>     print 'STATUS:',headers["status"]
>>     return body
>>
>> queue = "queue22"
>> SendMessage(queue, "test message2")
>> SendMessage(queue, "test message3")
>> SendMessage(queue, "test message4")
>> sleep(1)
>> print GetMessage(queue, "GET")
>> print GetMessage(queue, "GET")
>> print GetMessage(queue, "GET")
>>
>>
>>     
>
>   



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message