https://github.com/tistaharahap/rabbit-to-http
https://github.com/tistaharahap/rabbit-to-http
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/tistaharahap/rabbit-to-http
- Owner: tistaharahap
- License: mit
- Created: 2020-08-15T11:53:52.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-19T12:58:14.000Z (almost 5 years ago)
- Last Synced: 2025-01-13T06:25:49.259Z (5 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rabbit to HTTP
This is a generic RabbitMQ consumer always forwarding messages to an HTTP endpoint.
## Env Vars
| Name | Description |
| :--- | :--- |
| `AMQP_CONN_STRING` | Required string |
| `AMQP_QUEUE` | Required string, also known as routing key |
| `AMQP_ORDERS_EXCHANGE` | Required string |
| `HTTP_ENDPOINT` | HTTP Endpoint to forward to |## How It Works
It forwards all messages consumed with a few assumptions expected to be true:
* Message body is a valid JSON
* The HTTP endpoint receives `POST` requests accepting `application/json` body
* No processing is done to the message body, forwards as is
* Acknowledge (ack) messages when the HTTP endpoints returns with a `[200, 201, 204]` status code
* Does not acknowledge (nack) when the HTTP endpoints does not return with the above status codes and requeues## Running
```shell
$ python3 -m virtualenv
$ virtualenv env
$ . env/bin/activate
$ pip install -r requirements.txt
$ ./run-local.sh
```### Docker
Any commits pushed to the `master` branch will automatically push docker images to `tistaharahap/rabbit-to-http:latest`.
```shell
$ docker run -d --name tv-alerts -e AMQP_CONN_STRING=your_conn_string -e AMQP_QUEUE=your_queue -e HTTP_ENDPOINT=your_endpoint tistaharahap/rabit-to-http:latest
```