HTTP

HTTP stands for Hypertext Transfer Protocol and it is an application-level protocol for distributed, collaborative, hypermedia information systems. HTTP is not a messaging protocol. However, RabbitMQ can transmit messages over HTTP.

The rabbitmq-management plugin provides an HTTP-based API for management and monitoring of your RabbitMQ server. It is enabled by default on all CloudAMQP instances and assigned port 443.

The full HTTP API reference can be found here.

Publish with HTTP

Example of how to publish a message to the default exhange with the routing key "my_key":

curl -XPOST -d'{"properties":{},"routing_key":"my_key","payload":"my body","payload_encoding":"string"}' https://username:password@hostname/api/exchanges/vhost/amq.default/publish

Respons: {"routed":true}
Get message with HTTP

Example of how to get one message from the queue "your_queue". (This is not an HTTP GET as it will alter the state of the queue.)

curl -XPOST -d'{"count":1,"requeue":true,"encoding":"auto"}' https://username:password@hostname/api/queues/your_vhost/your_queue/get

Respons: Json message with payload and properties.

Get queue information

curl -XGET https://username:password@hostname/api/queues/your_vhost/your_queue

Respons: Json message with queue information.

Autoscale by polling queue length

When jobs are arriving faster to the queue than they are processed - and when the queue starts growing in length, it is a good idea to spin up more workers. An idea is to poll the HTTP API queue length and spin up or take down workers depending on the length.