.TH "amqp-consume" "1" .SH "NAME" amqp-consume \(em Consume messages from a queue on an AMQP server .SH "SYNOPSIS" .PP \fBamqp-consume\fR \fIOPTION\fR \fIcommand\fR \fIargs\fR .SH "Description" .PP \fBamqp-consume\fR consumes messages from a queue on an AMQP server. For each message that arrives, a receiving command is run, with the message body supplied to it on standard input. .PP \fBamqp-consume\fR can consume from an existing queue, or it can create a new queue. It can optionally bind the queue to an existing exchange. .PP By default, messages will be consumed with explicit acknowledgements. A message will only be acknowledged if the receiving command exits successfully (i.e. with an exit code of zero). The AMQP ``\fIno ack\fP'' mode (a.k.a. auto-ack mode) can be enable with the \fB-A\fP option. .SH "Options" .IP "\fB-q\fP" 10 .IP "\fB\-\-queue\fP=\fIqueue name\fR" 10 The name of the queue to consume messages from. .IP "" 10 If the \fB\-\-queue\fP option is omitted, the AMQP server will assign a unique name to the queue, and that server-assigned name will be dixsplayed on stderr; this case implies that an exclusive queue should be declared. .IP "\fB-e\fP" 10 .IP "\fB\-\-exchange\fP=\fIexchange name\fR" 10 Specifies that an exclusive queue should be declared, and bound to the given exchange. The specified exchange should already exist unless the \fB\-\-exchange-type\fP option is used to request the creation of an exchange. .IP "\fB-r\fP" 10 .IP "\fB\-\-routing-key\fP=\fIrouting key\fR" 10 The routing key for binding. If omitted, an empty routing key is assumed. .IP "\fB-d\fP" 10 .IP "\fB\-\-declare\fP" 10 Forces an exclusive queue to be declared, even when it otherwise would not be. That is, when a queue name is specified with the \fB\-\-queue\fP option, but no binding to an exchange is requested with the \fB\-\-exchange\fP option. Note: this option is deprecated and may be removed in a future version, use the \fB\-\-exclusive\fP option to explicitly declare an exclusive queue. .IP "\fB-x\fP" 10 .IP "\fB\-\-exclusive\fP" 10 Declared queues are non-exclusive by default, this option forces declaration of exclusive queues. .IP "\fB-A\fP" 10 .IP "\fB\-\-no-ack\fP=\fIrouting key\fR" 10 Enable ``\fIno ack\fP'' mode: The AMQP server will unconditionally acknowledge each message that is delivered, regardless of whether the target command exits successfully or not. .IP "\fB-c\fP" 10 .IP "\fB\-\-count\fP=\fIlimit\fR" 10 Stop consuming after the given number of messages have been received. .IP "\fB-p\fP" 10 .IP "\fB\-\-prefetch-count\fP=\fIlimit\fR" 10 Request the server to only send \fIlimit\fR messages at a time. .IP "" 10 If any value was passed to \fB\-\-count\fP, the value passed to \fB\-\-prefetch-count\fP should be smaller than that, or otherwise it will be ignored. .IP "" 10 If \fB-A\fP/\fB\-\-no-ack\fP is passed, this option has no effect. .SH "Examples" .IP "Consume messages from an existing queue ``\fI\fBmyqueue\fP\fP'', and output the message bodies on standard output via \fBcat\fR:" 10 .PP .nf $ .ft B amqp-publish \-q myqueue cat .ft .fi .IP "Bind a new exclusive queue to an exchange ``\fI\fBmyexch\fP\fP'', and send each message body to the script \fBmyscript\fP, automatically acknowledging them on the server:" 10 .PP .nf $ .ft B amqp-consume \-A \-e myexch ./myscript .ft .fi .SH "See also" .PP \fBlibrabbitmq-tools\fP\fB(7)\fP describes connection-related options common to all the RabbitMQ C Client tools. .\" created by instant / docbook-to-man, Fri 14 Nov 2014, 16:40