amqpcat
netcat for AMQP. CLI tool to publish to and consume from AMQP servers.
Installation
Using snap:
snap install amqpcatUsing Homebrew in OS X:
brew install cloudamqp/cloudamqp/amqpcatUsing Docker/Podman:
docker run -it cloudamqp/amqpcatFrom source:
brew install crystal # os x
snap install crystal # linux/ubuntu
git clone https://github.com/cloudamqp/amqpcat.git
cd amqpcat
shards build --release --productionThere are more Crystal installation alternatives.
Usage
Usage: amqpcat [arguments]
    -P, --producer                   Producer mode, reading from STDIN, each line is a new message
    -C, --consumer                   Consume mode, message bodies are written to STDOUT
    -u URI, --uri=URI                URI to AMQP servera
    -d DIR, --dir=DIR                Directory to dump messages info when consuming
    -e EXCHANGE, --exchange=EXCHANGE Exchange
    -r ROUTINGKEY, --routing-key=KEY Routing key when publishing
    -q QUEUE, --queue=QUEUE          Queue to consume from
    -f FORMAT, --format=FORMAT       Format string (default "%s\n")
                     %e: Exchange name
                     %r: Routing key
                     %s: Body, as string
                     \n: Newline
                     \t: Tab
    -v, --version                    Display version
    -h, --help                       Show this help messageExamples
Send messages to a queue named test:
echo Hello World | amqpcat --producer --uri=$CLOUDAMQP_URL --queue testConsume from the queue named test:
amqpcat --consumer --uri=$CLOUDAMQP_URL --queue testConsume from the queue named files, dumping each message into a given
directory, instead of STDOUT, deriving the filename from the message
properties, or timestamp if no properties are set:
amqpcat --consumer --uri=$CLOUDAMQP_URL --queue files --dir /tmp/miaow/With a temporary queue, consume messages sent to the exchange amq.topic with the routing key 'hello.world':
amqpcat --consumer --uri=$CLOUDAMQP_URL --exchange amq.topic --routing-key hello.worldConsume from the queue named test, format the output as CSV and pipe to file:
amqpcat --consumer --uri=$CLOUDAMQP_URL --queue test --format "%e,%r,"%s"\n | tee messages.csvPublish messages from syslog to the exchange 'syslog' topic with the hostname as routing key
tail -f /var/log/syslog | amqpcat --producer --uri=$CLOUDAMQP_URL --exchange syslog --routing-key $HOSTNAMEConsume, parse and extract data from json messages:
amqpcat --consumer --queue json | jq .propertyDevelopment
amqpcat is built with Crystal
Contributing
- Fork it (https://github.com/cloudamqp/amqpcat/fork)
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- Carl Hörberg - creator and maintainer