cURL and ActiveMQ cURL and ActiveMQ curl curl

cURL and ActiveMQ


First I assume:

  • You are running activemq 5.5.0
  • You are using the default activemq configuration that enables the web-console
  • By cURL you mean libcurl and a command line example is sufficient

Example:

  • Create a queue named test, set the body to hello world.
    • Note: [clientId] this a unique string to identify your subscribe otherwise a new consumer will be created for each request see REST
    • $ curl -d 'body="Hello World"' "http://localhost:8161/demo/message/test?type=queue&clientId=consumerA"
  • Pop the message of the queue
    • $ curl -X delete "http://localhost:8161/demo/message/test?type=queue&clientId=consumerA"
    • You should see "Hello World"
  • Finally unsubscribe from the queue
    • $ curl -d 'action=unsubscribe' "http://localhost:8161/demo/message/test?type=queue&clientId=consumerA"

You should be able to monitor all of the above operations from the admin interface


Until version 5.8, REST API was part of the Web Samples and was mapped to http://localhost:8161/demo/message url. From 5.8 onwards, the API is available by default at http://localhost:8161/api/message url

http://activemq.apache.org/rest.html