amqp-publish(1) General Commands Manual amqp-publish(1)
amqp-publish — Publish a message on an AMQP server
Publishes a message to an exchange on an AMQP server. Options allow the various proper‐
ties of the message and parameters of the AMQP basic.publish method to be
By default, the message body is read from standard input. Alternatively, the -b option
allows the message body to be provided as part of the command.
The name of the exchange to publish to. If omitted, the default exchange (also
known as the nameless exchange) is used.
The routing key to publish with. If omitted, an empty routing key is assumed.
A routing key must be specified when publishing to the default exchange; in that
case, accoding to the AMQP specification, the routing key corresponds to a queue
Use the persistent delivery mode. Without this option, non-persistent delivery
Specifies the content-type property for the message. If omitted, the content-
type property is not set on the message.
Specifies the content-encoding property for the message. If omitted, the con‐
tent-encoding property is not set on the message.
Specifies the message body. If omitted, the message body is read from standard
Send a short message, consisting of the word
``Hello'' to the queue ``myqueue'' via the default exchange:" 10
amqp-publish -r myqueue -b Hello
Send some XML data from a file to the exchange
``events'', with persistent delivery mode, setting the content-type property on the
message to make the data format explicit:" 10
amqp-publish -e events -p -C text/xml event.xml
librabbitmq-tools(7) describes connection-related options common to all the
RabbitMQ C Client tools.