activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yesnid <ns...@pelco.com>
Subject Re: Problem with HTTP/REST
Date Thu, 04 Sep 2008 20:03:37 GMT

I Am getting the same error, did anyone solve this for you? or Does anyone
know the solution?

Please let me know.

Thank you.


sv75 wrote:
> 
> I'm playng with AMQ 5.1 and HTTP/REST in demo application works strange 
> :(
> 
> Posting to http://localhost:8161/demo/message/myQueue works fine, but I
> have problems with GET.
> It works first time, but then I always get HTTP status 204 and empty body,
> with lots of pending message in queues. The following problems is always
> reproduced. After restarting AMQ:
> 
> $ wget
> "http://localhost:8161/demo/message/myQueue?type=queue&readTimeout=500"
> HTTP request sent, awaiting response... 200 OK
> Length: 21 [text/xml]
> (works fine, next message)
> 
> $ wget
> "http://localhost:8161/demo/message/myQueue?type=queue&readTimeout=500"
> HTTP request sent, awaiting response... 204 No Content
> (and no body)
> 
> And then I get status 204 until AMQ is restarted. So, I can GET only
> single message. I'm very confused. 
> I think I make some very basic error :(( 
> 
> I also wrote simple client in Python that handle cookie -- same result.
> 
> #!/usr/bin/python
> 
> import httplib2
> import urllib
> from time import sleep
> 
> BASE = "http://localhost:8161/demo/message/"
> client = httplib2.Http(".cache")
> cookie = None
> 
> def SendMessage(queue, body):
>     url = BASE + queue
>     print "[%s] -> %s" % (body, url)
>     body = urllib.urlencode({"type": "queue", "body" : body})
>     headers, body = client.request(url, "POST", body,
>     headers={"Content-type": "application/x-www-form-urlencoded"})        
>     print headers
> 
> def GetMessage(queue):
>     global cookie
>     url = BASE +  queue + "?" + urllib.urlencode({"type": "queue",
> "readTimeout": 1000})
>     print url,'->'
>     headers = {}
>     if cookie:
>        headers['Cookie'] = cookie
>     print headers   
>     response, body = client.request(url, "GET", None, headers)
>     print response
>     try:
>        cookie = response['set-cookie'] 
>     except:
>         pass	    
>     return body
> 
> queue = "myQueue"
> SendMessage(queue, "test message1")
> SendMessage(queue, "test message2")
> SendMessage(queue, "test message3")
> sleep(1)
> print GetMessage(queue)
> print GetMessage(queue)
> print GetMessage(queue)
> 
> 

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


Mime
View raw message