summaryrefslogtreecommitdiff
path: root/tools/doc/publish.xml
blob: d2e8d2e058581daa6b3d5e835e5ba808ffdea0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd"
[
<!ENTITY date SYSTEM "man-date.ent" >
]
>
<refentry lang="en">
    <refentryinfo>
        <productname>RabbitMQ C Client</productname>
        <authorgroup>
            <corpauthor>The RabbitMQ Team &lt;<ulink url="mailto:info@rabbitmq.com"><email>info@rabbitmq.com</email></ulink>&gt;</corpauthor>
        </authorgroup>
        <date>&date;</date>
    </refentryinfo>

    <refmeta>
        <refentrytitle>amqp-publish</refentrytitle>
        <manvolnum>1</manvolnum>
        <refmiscinfo class="manual">RabbitMQ C Client</refmiscinfo>
    </refmeta>

    <refnamediv>
        <refname>amqp-publish</refname>
        <refpurpose>Publish a message on an AMQP server</refpurpose>
    </refnamediv>

    <refsynopsisdiv>
        <cmdsynopsis>
            <command>amqp-publish</command>
            <arg choice="opt" rep="repeat">
                <replaceable>OPTION</replaceable>
            </arg>
        </cmdsynopsis>
    </refsynopsisdiv>
    
    <refsect1>
        <title>Description</title>
        <para>
            Publishes a message to an exchange on an AMQP server.
            Options allow the various properties of the message and
            parameters of the AMQP <function>basic.publish</function>
            method to be specified.
        </para>
        <para>
            By default, the message body is read from standard input.
            Alternatively, the <option>-b</option> option allows the message
            body to be provided as part of the command.
        </para>
    </refsect1>

    <refsect1>
        <title>Options</title>
        <variablelist>
            <varlistentry>
                <term><option>-e</option></term>
                <term><option>--exchange</option>=<replaceable class="parameter">exchange name</replaceable></term>
                <listitem>
                    <para>
                        The name of the exchange to publish to.  If
                        omitted, the default exchange (also known as
                        the nameless exchange) is used.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>-r</option></term>
                <term><option>--routing-key</option>=<replaceable class="parameter">routing key</replaceable></term>
                <listitem>
                    <para>
                        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 name.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>-p</option></term>
                <term><option>--persistent</option></term>
                <listitem>
                    <para>
                        Use the persistent delivery mode.  Without
                        this option, non-persistent delivery is used.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>-C</option></term>
                <term><option>--content-type</option>=<replaceable class="parameter">MIME type</replaceable></term>
                <listitem>
                    <para>
                        Specifies the content-type property for the
                        message.  If omitted, the content-type
                        property is not set on the message.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>-E</option></term>
                <term><option>--content-encoding</option>=<replaceable class="parameter">content coding</replaceable></term>
                <listitem>
                    <para>
                        Specifies the content-encoding property for
                        the message.  If omitted, the content-encoding
                        property is not set on the message.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term><option>-b</option></term>
                <term><option>--body</option>=<replaceable class="parameter">message body</replaceable></term>
                <listitem>
                    <para>
                        Specifies the message body.  If omitted, the
                        message body is read from standard input.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>

    <refsect1>
        <title>Examples</title>
        <variablelist>
            <varlistentry>
                <term>Send a short message, consisting of the word
                <quote><literal>Hello</literal></quote> to the queue
                <quote><systemitem
                class="resource">myqueue</systemitem></quote> via the
                default exchange:</term>
                <listitem>
                    <screen><prompt>$ </prompt><userinput>amqp-publish -r myqueue -b Hello</userinput></screen>
                </listitem>
            </varlistentry>

            <varlistentry>
                <term>Send some XML data from a file to the exchange
                <quote><systemitem
                class="resource">events</systemitem></quote>, with
                persistent delivery mode, setting the content-type
                property on the message to make the data format
                explicit:</term>
                <listitem>
                    <screen><prompt>$ </prompt><userinput>amqp-publish -e events -p -C text/xml &lt;event.xml</userinput></screen>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsect1>

    <refsect1>
        <title>See also</title>
        <para>
            <citerefentry><refentrytitle>librabbitmq-tools</refentrytitle><manvolnum>7</manvolnum></citerefentry>
            describes connection-related options common to all the
            RabbitMQ C Client tools.
        </para>
    </refsect1>
</refentry>