| 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" |
| 3 | [ |
| 4 | <!ENTITY date SYSTEM "man-date.ent" > |
| 5 | ] |
| 6 | > |
| 7 | <refentry lang="en"> |
| 8 | <refentryinfo> |
| 9 | <productname>RabbitMQ C Client</productname> |
| 10 | <authorgroup> |
| 11 | <corpauthor>The RabbitMQ Team <<ulink url="mailto:[email protected]"><email>[email protected]</email></ulink>></corpauthor> |
| 12 | </authorgroup> |
| 13 | <date>&date;</date> |
| 14 | </refentryinfo> |
| 15 | |
| 16 | <refmeta> |
| 17 | <refentrytitle>amqp-publish</refentrytitle> |
| 18 | <manvolnum>1</manvolnum> |
| 19 | <refmiscinfo class="manual">RabbitMQ C Client</refmiscinfo> |
| 20 | </refmeta> |
| 21 | |
| 22 | <refnamediv> |
| 23 | <refname>amqp-publish</refname> |
| 24 | <refpurpose>Publish a message on an AMQP server</refpurpose> |
| 25 | </refnamediv> |
| 26 | |
| 27 | <refsynopsisdiv> |
| 28 | <cmdsynopsis> |
| 29 | <command>amqp-publish</command> |
| 30 | <arg choice="opt" rep="repeat"> |
| 31 | <replaceable>OPTION</replaceable> |
| 32 | </arg> |
| 33 | </cmdsynopsis> |
| 34 | </refsynopsisdiv> |
| 35 | |
| 36 | <refsect1> |
| 37 | <title>Description</title> |
| 38 | <para> |
| 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. |
| 43 | </para> |
| 44 | <para> |
| 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. |
| 48 | </para> |
| 49 | </refsect1> |
| 50 | |
| 51 | <refsect1> |
| 52 | <title>Options</title> |
| 53 | <variablelist> |
| 54 | <varlistentry> |
| 55 | <term><option>-e</option></term> |
| 56 | <term><option>--exchange</option>=<replaceable class="parameter">exchange name</replaceable></term> |
| 57 | <listitem> |
| 58 | <para> |
| 59 | The name of the exchange to publish to. If |
| 60 | omitted, the default exchange (also known as |
| 61 | the nameless exchange) is used. |
| 62 | </para> |
| 63 | </listitem> |
| 64 | </varlistentry> |
| 65 | <varlistentry> |
| 66 | <term><option>-r</option></term> |
| 67 | <term><option>--routing-key</option>=<replaceable class="parameter">routing key</replaceable></term> |
| 68 | <listitem> |
| 69 | <para> |
| 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, according to |
| 74 | the AMQP specification, the routing key |
| 75 | corresponds to a queue name. |
| 76 | </para> |
| 77 | </listitem> |
| 78 | </varlistentry> |
| 79 | <varlistentry> |
| 80 | <term><option>-p</option></term> |
| 81 | <term><option>--persistent</option></term> |
| 82 | <listitem> |
| 83 | <para> |
| 84 | Use the persistent delivery mode. Without |
| 85 | this option, non-persistent delivery is used. |
| 86 | </para> |
| 87 | </listitem> |
| 88 | </varlistentry> |
| 89 | <varlistentry> |
| 90 | <term><option>-C</option></term> |
| 91 | <term><option>--content-type</option>=<replaceable class="parameter">MIME type</replaceable></term> |
| 92 | <listitem> |
| 93 | <para> |
| 94 | Specifies the content-type property for the |
| 95 | message. If omitted, the content-type |
| 96 | property is not set on the message. |
| 97 | </para> |
| 98 | </listitem> |
| 99 | </varlistentry> |
| 100 | <varlistentry> |
| 101 | <term><option>-E</option></term> |
| 102 | <term><option>--content-encoding</option>=<replaceable class="parameter">content coding</replaceable></term> |
| 103 | <listitem> |
| 104 | <para> |
| 105 | Specifies the content-encoding property for |
| 106 | the message. If omitted, the content-encoding |
| 107 | property is not set on the message. |
| 108 | </para> |
| 109 | </listitem> |
| 110 | </varlistentry> |
| 111 | <varlistentry> |
| 112 | <term><option>-b</option></term> |
| 113 | <term><option>--body</option>=<replaceable class="parameter">message body</replaceable></term> |
| 114 | <listitem> |
| 115 | <para> |
| 116 | Specifies the message body. If omitted, the |
| 117 | message body is read from standard input. |
| 118 | </para> |
| 119 | </listitem> |
| 120 | </varlistentry> |
| 121 | <varlistentry> |
| 122 | <term><option>-H</option></term> |
| 123 | <term><option>--header</option>=<replaceable class="parameter">header</replaceable></term> |
| 124 | <listitem> |
| 125 | <para> |
| 126 | Specifies an optional header in the form "key: value". |
| 127 | </para> |
| 128 | </listitem> |
| 129 | </varlistentry> |
| 130 | </variablelist> |
| 131 | </refsect1> |
| 132 | |
| 133 | <refsect1> |
| 134 | <title>Examples</title> |
| 135 | <variablelist> |
| 136 | <varlistentry> |
| 137 | <term>Send a short message, consisting of the word |
| 138 | <quote><literal>Hello</literal></quote> to the queue |
| 139 | <quote><systemitem |
| 140 | class="resource">myqueue</systemitem></quote> via the |
| 141 | default exchange:</term> |
| 142 | <listitem> |
| 143 | <screen><prompt>$ </prompt><userinput>amqp-publish -r myqueue -b Hello</userinput></screen> |
| 144 | </listitem> |
| 145 | </varlistentry> |
| 146 | |
| 147 | <varlistentry> |
| 148 | <term>Send some XML data from a file to the exchange |
| 149 | <quote><systemitem |
| 150 | class="resource">events</systemitem></quote>, with |
| 151 | persistent delivery mode, setting the content-type |
| 152 | property on the message to make the data format |
| 153 | explicit:</term> |
| 154 | <listitem> |
| 155 | <screen><prompt>$ </prompt><userinput>amqp-publish -e events -p -C text/xml <event.xml</userinput></screen> |
| 156 | </listitem> |
| 157 | </varlistentry> |
| 158 | </variablelist> |
| 159 | </refsect1> |
| 160 | |
| 161 | <refsect1> |
| 162 | <title>See also</title> |
| 163 | <para> |
| 164 | <citerefentry><refentrytitle>librabbitmq-tools</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 165 | describes connection-related options common to all the |
| 166 | RabbitMQ C Client tools. |
| 167 | </para> |
| 168 | </refsect1> |
| 169 | </refentry> |