CURL and ActiveMQ

I need an example of how to read / write to the ActiveMQ queue via HTTP in C or C ++ using cURL (or something else, I'm open to anything at this point). I have working code in C #, but that does not help. Any help is appreciated, thanks.

+4
source share
2 answers

First I assume:

  • You are running activeemq 5.5.0
  • You are using activemq default configuration which allows web-console
  • By cURL, you mean libcurl, and a command line example is enough

An example :

  • Create a queue called test, set the body to the welcome world.
    • Note: [clientId] is a unique line to identify your subscription, 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"
  • Show queue message
    • $ 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 control all of the above operations using the admin interface.

+3
source

Prior to version 5.8, the REST API was part of web samples and was mapped to http: // localhost: 8161 / demo / message url. Starting with 5.8, the default API is http: // localhost: 8161 / api / message url

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

0
source

All Articles