activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yesnid <ns...@pelco.com>
Subject Re: REST: eternal HTTP status 204
Date Thu, 04 Sep 2008 20:14:26 GMT

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")
> 
> 

-- 
View this message in context: http://www.nabble.com/REST%3A-eternal-HTTP-status-204-tp13269025p19319033.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message