Sign inSign up

shekeriev/rabbit-prod

By shekeriev

•Updated over 3 years ago

A sample RabbitMQ producer, written in Python and used for demonstration purposes.

Image
0

894

shekeriev/rabbit-prod repository overview

⁠RabbitMQ Sample Producer

⁠Description

Publishes random log messages to a topic based exchange with random delay (between 5 and 20 seconds) between every two messages

⁠Available variables

VariableDescriptionDefault value
BROKERBroker to connect to (name)localhost
BROKERPORTBroker's port to use (5672)5672
EXCHANGEExchange to bind to (topic)demo

⁠Usage

# Syntax
docker container run [-d|-it] [--name fancyname] [--net appnet] [-e VAR1=VALUE1 -e ...] shekeriev/rabbit-prod 

# Example
docker container run -d --name prod --net appnet -e BROKER=rabbitmq -e BROKERPORT=5672 -e TOPIC=demo shekeriev/rabbit-prod

⁠Sample output

Here is a sample output:

 [x] (R) Producer started. Press Ctrl+C to stop.
 [x] (R) Working against prep on rabbitmq:5672. Producing ...
 [x] (R) 2023-01-28 13:04:48 Sent: 'warn: cpu load is 70'
 [x] (R) 2023-01-28 13:04:48 Sleep for 9 second(s).
 [x] (R) 2023-01-28 13:04:57 Sent: 'info: ram load is 34'
 [x] (R) 2023-01-28 13:04:57 Sleep for 5 second(s).
 [x] (R) 2023-01-28 13:05:02 Sent: 'warn: cpu load is 73'
 [x] (R) 2023-01-28 13:05:02 Sleep for 18 second(s).

⁠Source code

The latest version of the source code can be obtained from here: https://github.com/shekeriev/do2-app-pack/tree/main/rabbit-prod⁠

Tag summary

Content type

Image

Digest

sha256:d9a8956e6…

Size

48 MB

Last updated

over 3 years ago

docker pull shekeriev/rabbit-prod