activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sv75 <>
Subject REST: eternal HTTP status 204
Date Thu, 18 Oct 2007 06:45:51 GMT

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.

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")
print GetMessage(queue, "GET")
print GetMessage(queue, "GET")
print GetMessage(queue, "GET")

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message