CloudAMQP Console Webhooks

Sometimes applications need to be able to act and react to real-time data from other applications, and to do so, they need to communicate. Webhooks (or web callback, HTTP push API) are used to push data as soon as it’s received to its recipients, meaning that applications are notified directly with the trigger of an alarm or a specific action on a website.

Using webhooks allows for data to be pushed directly instead of periodically polling for new data (as for APIs), making application interaction instant. Use webhooks if you need a real-time notification of events, e.g., alarm notifications can be received via webhooks (link to monitoring alarms.)

Webhooks will do a POST request for any messages placed in a specified queue to a specified URL. A POST request will be made for each message in the queue with the AMQP message body as the HTTP-request body. If the endpoint returns a HTTP status code in the 200 range, the message will be acknowledged and removed from the queue, otherwise it will retry to POST it again.

Any headers included with the AMQP message will be inserted to the HTTP request headers. Be aware that this can lead to some issues with some HTTP endpoints. For example, the content-type for an AMQP message may not align with accepted content-type for the HTTP endpoint.

A webhook can be configured from the Webhook view in the CloudAMQP console or through the API.

Add webhook/push-queue

vhost [vhost]
The vhost the queue resides in.
Queue [queue name]
A (durable) queue on your RabbitMQ instance (in your default vhost).
Endpoint [host endpoint]
A POST request will be made for each message in the queue to this endpoint. If the endpoint returns a HTTP status code in the 200 range the message will be acknowledged and removed from the queue, otherwise retried.
Concurrency [number]
Max simultaneous outstanding requests to the endpoint.

Handling webhook message failure

When a message fails on delivery for 7 consecutive days it will be rejected, these messages can be recovered by setting up a DLX: When and how to use dead letter exchange

Popular webhook use cases

RabbitMQ variable shovel plugin, which allows RabbitMQ to call a webhook for each message in a queue: RabbitMQ vshovel plugin.