Quick demo of rabbitmq with existing tools just to see it in action.
- Run a rabbitmq container so you won’t have to install it on the local machine:
docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:4-management - Download
rabbmitmqadminfrom your local instance:wget http://localhost:15672/cli/rabbitmqadmin - Make the tool executable:
chmod +x ./rabbitmqadmin - Check the queue
./rabbitmqadmin list queues
No items
- Declare a queue
./rabbitmqadmin declare queue name=greetings durable=true
queue declared
- Publish a message
./rabbitmqadmin publish exchange=amq.default routing_key=greetings payload="Hello, World"
Message published
- Check the queue again
./rabbitmqadmin list queues
+-----------+----------+
| name | messages |
+-----------+----------+
| greetings | 1 |
+-----------+----------+
- Get the message
./rabbitmqadmin get queue=greetings
+-------------+----------+---------------+--------------+---------------+------------------+------------+-------------+
| routing_key | exchange | message_count | payload | payload_bytes | payload_encoding | properties | redelivered |
+-------------+----------+---------------+--------------+---------------+------------------+------------+-------------+
| greetings | | 0 | Hello, World | 12 | string | | False |
+-------------+----------+---------------+--------------+---------------+------------------+------------+-------------+