amqp-publish
A simple tool to publish messages to RabbitMQ from the command line.
Setup
Download the latest release binary and save it to /usr/local/bin
or any executable path.
Usage
Publish to exchange
amqp-publish --uri="amqp://admin:password@localhost:5672/" --exchange="foo" --routing-key="awesome-routing-key" --body="hello, world!"
Publish the bar
queue directly, using RabbitMQ default exchange
amqp-publish --uri="amqp://admin:password@localhost:5672/" --exchange="" --routing-key="bar" --body="hello, world!"
Publish using an input file
# Use one message per line
echo '{"foo": "bar-1"}' >> file.txt
echo '{"foo": "bar-2"}' >> file.txt
echo '{"foo": "bar-3"}' >> file.txt
amqp-publish --uri="amqp://admin:password@localhost:5672/" --exchange="foo" --routing-key="bar" --input-file="file.txt"
Credit
Streadway's AMQP Go library.