Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-1471

ActiveMQ via HTTP working strange

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 5.0.0
    • AGING_TO_DIE
    • None
    • None
    • Ubuntu/Debian, JDK 1.6

    Description

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

      Attachments

        1. amq_http_client.py
          0.9 kB
          vsevolod

        Activity

          People

            Unassigned Unassigned
            sv75 vsevolod
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: