ActiveMQ via HTTP working strange
---------------------------------

                 Key: AMQ-1471
                 URL: https://issues.apache.org/activemq/browse/AMQ-1471
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.0.0
         Environment: Ubuntu/Debian, JDK 1.6
            Reporter: vsevolod
            Priority: Minor


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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to