___ ___ ___ ___ ___ ___ /__/\ ___ ___ / /\ / /\ / /\ / /\ / /\ \ \:\ / /\ / /\ / /::\ / /:/_ / /::\ / /:/_ / /:/_ \__\:\ / /:/ / /:/ / /:/\:\ / /:/ /\ / /:/\:\ / /:/ /\ / /:/ /\ ___ / /::\ / /:/ / /:/ / /:/~/:/ / /:/ /::\ / /:/~/::\ / /:/ /:/ / /:/ /:/_ /__/\ /:/\:\ / /::\ / /::\ /__/:/ /:/ /__/:/ /:/\:\ /__/:/ /:/\:\ /__/:/ /:/ /__/:/ /:/ /\ \ \:\/:/__\/ /__/:/\:\ /__/:/\:\ \ \:\/:/ \ \:\/:/~/:/ \ \:\/:/__\/ \ \:\/:/ \ \:\/:/ /:/ \ \::/ \__\/ \:\ \__\/ \:\ \ \::/ \ \::/ /:/ \ \::/ \ \::/ \ \::/ /:/ \ \:\ \ \:\ \ \:\ \ \:\ \__\/ /:/ \ \:\ \ \:\ \ \:\/:/ \ \:\ \__\/ \__\/ \ \:\ /__/:/ \ \:\ \ \:\ \ \::/ \__\/ \__\/ \__\/ \__\/ \__\/ \__\/
A store-and-forward HTTP gateway plugin for RabbitMQ.
To simplify the integration and communication of services over HTTP by relieving systems from the chore of resending requests when something went wrong with "the other side".
http-safe goes beyond the fire and forget paradigm as it supports the notion of delivery callback in order to inform the originating system of the success or failure of its dispatch request.
If you're running in the cloud and are OK using Amazon AWS, then consider using SNS instead of http-safe :)
In order to use the http-safe plugin, you need first to install the following plugins on RabbitMQ 2.3.1:
If you don't build the plugin from source, then get the latest one from the above download link.
Good news: there is nothing to configure in order to use http-safe.
If you're not happy with the port it's listening on, you'll need to configure the Mochiweb plugin as explained here.
Using http-safe is very straightforward: you simply send it the HTTP request your intending to send to a server, using whatever verb you want, and just add a few control headers. http-safe will then try to send it to the intended recipient as fast as it can, retrying as much and as often as configured. In case of success or failure, it can optionally call you back.
After sending to http://<rabbit_host>:55672/http-safe/in, http-safe responds:
204
X-SAFE-Correlation-Id: <correlation_id>
This correlation ID header will be added to the dispatched HTTP request for traceability.
Here are the HTTP headers that you must/can include in your request to http-safe:
Header | Required? | Value |
---|---|---|
X-SAFE-Target-URI | Yes | The URI of the target server. |
X-SAFE-Accept-Regex | Yes | A regular expression that must be matched by the status code replied by the target server. |
X-SAFE-Max-Retries | No | Number of resend attempts to perform if the first dispatch failed. Default is 0. |
X-SAFE-Retry-Interval | Yes if X-SAFE-Max-Retries > 0 | The number of minutes between two dispatch attempts. Must be >0 and <=60. |
X-SAFE-Callback-URI | No | The URI of a server to call in case of successfull or aborted (ie. all attempts failed) dispatch. http-safe will POST the entity received from the target server. |
In addition to the X-SAFE-Correlation-Id header shown above, http-safe can add the following headers when it calls you back:
- X-SAFE-Forward-Outcome: 'success' or 'failure',
- X-SAFE-Forward-Status: the status code replied by the target server.
- The maximum size of an HTTP entity that can be stored-and-forwarded is 1MB.