1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd"
4
<!ENTITY date SYSTEM "man-date.ent" >
9
<productname>RabbitMQ C Client</productname>
11
<corpauthor>The RabbitMQ Team <<ulink url="mailto:info@rabbitmq.com"><email>info@rabbitmq.com</email></ulink>></corpauthor>
17
<refentrytitle>amqp-publish</refentrytitle>
18
<manvolnum>1</manvolnum>
19
<refmiscinfo class="manual">RabbitMQ C Client</refmiscinfo>
23
<refname>amqp-publish</refname>
24
<refpurpose>Publish a message on an AMQP server</refpurpose>
29
<command>amqp-publish</command>
30
<arg choice="opt" rep="repeat">
31
<replaceable>OPTION</replaceable>
37
<title>Description</title>
39
Publishes a message to an exchange on an AMQP server.
40
Options allow the various properties of the message and
41
parameters of the AMQP <function>basic.publish</function>
42
method to be specified.
45
By default, the message body is read from standard input.
46
Alternatively, the <option>-b</option> option allows the message
47
body to be provided as part of the command.
52
<title>Options</title>
55
<term><option>-e</option></term>
56
<term><option>--exchange</option>=<replaceable class="parameter">exchange name</replaceable></term>
59
The name of the exchange to publish to. If
60
omitted, the default exchange (also known as
61
the nameless exchange) is used.
66
<term><option>-r</option></term>
67
<term><option>--routing-key</option>=<replaceable class="parameter">routing key</replaceable></term>
70
The routing key to publish with. If omitted,
71
an empty routing key is assumed. A routing
72
key must be specified when publishing to the
73
default exchange; in that case, accoding to
74
the AMQP specification, the routing key
75
corresponds to a queue name.
80
<term><option>-p</option></term>
81
<term><option>--persistent</option></term>
84
Use the persistent delivery mode. Without
85
this option, non-persistent delivery is used.
90
<term><option>-C</option></term>
91
<term><option>--content-type</option>=<replaceable class="parameter">MIME type</replaceable></term>
94
Specifies the content-type property for the
95
message. If omitted, the content-type
96
property is not set on the message.
101
<term><option>-E</option></term>
102
<term><option>--content-encoding</option>=<replaceable class="parameter">content coding</replaceable></term>
105
Specifies the content-encoding property for
106
the message. If omitted, the content-encoding
107
property is not set on the message.
112
<term><option>-b</option></term>
113
<term><option>--body</option>=<replaceable class="parameter">message body</replaceable></term>
116
Specifies the message body. If omitted, the
117
message body is read from standard input.
125
<title>Examples</title>
128
<term>Send a short message, consisting of the word
129
<quote><literal>Hello</literal></quote> to the queue
131
class="resource">myqueue</systemitem></quote> via the
132
default exchange:</term>
134
<screen><prompt>$ </prompt><userinput>amqp-publish -r myqueue -b Hello</userinput></screen>
139
<term>Send some XML data from a file to the exchange
141
class="resource">events</systemitem></quote>, with
142
persistent delivery mode, setting the content-type
143
property on the message to make the data format
146
<screen><prompt>$ </prompt><userinput>amqp-publish -e events -p -C text/xml <event.xml</userinput></screen>
153
<title>See also</title>
155
<citerefentry><refentrytitle>librabbitmq-tools</refentrytitle><manvolnum>7</manvolnum></citerefentry>
156
describes connection-related options common to all the
157
RabbitMQ C Client tools.