You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2011/08/11 22:12:29 UTC

[jira] [Closed] (AMQ-1471) ActiveMQ via HTTP working strange

     [ https://issues.apache.org/jira/browse/AMQ-1471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-1471.
-----------------------------

    Resolution: Cannot Reproduce

> ActiveMQ via HTTP working strange
> ---------------------------------
>
>                 Key: AMQ-1471
>                 URL: https://issues.apache.org/jira/browse/AMQ-1471
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.0.0
>         Environment: Ubuntu/Debian, JDK 1.6
>            Reporter: vsevolod
>            Priority: Minor
>             Fix For: AGING_TO_DIE
>
>         Attachments: amq_http_client.py
>
>
> I'm not sure it is bug or I'm just dumb so sorry if I messed up. I tried 5.0 Snapshot with simple python client (included below) and it acts strange. And so localhost:8161/demo does. Getting first message is no problem but then AMQ returns HTTP status 204  (Not changed) and empty message body - until AMR restarted. What I'm doing wrong?
> Output:
> [test message2] -> http://localhost:8161/demo/message/queue23
> [test message3] -> http://localhost:8161/demo/message/queue23
> [test message4] -> http://localhost:8161/demo/message/queue23
> http://localhost:8161/demo/message/queue23?type=queue&timeout=100 ->
> STATUS: 200
> test message2
> http://localhost:8161/demo/message/queue23?type=queue&timeout=100 ->
> STATUS: 204
> http://localhost:8161/demo/message/queue23?type=queue&timeout=100 ->
> STATUS: 204
> Program (very short):
> ==========
> #!/usr/bin/python
> import httplib2
> import urllib
> from time import *
> BASE = "http://localhost:8161/demo/"
> client = httplib2.Http(".cache")
> dtype = "queue"
> def SendMessage(queue, body):
>     url = BASE + "message/" +  queue
>     print "[%s] -> %s" % (body, url) 
>     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": 100})
>     print url,'->'
>     headers, body = client.request(url, method, None, None)
>     print 'STATUS:',headers["status"]
>     return body
> queue = "queue23"
> 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")

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira