'\" t .\" Title: amqp-consume .\" Author: The RabbitMQ Team <\m[blue]\fBinfo@rabbitmq.com\fR\m[]> .\" Generator: DocBook XSL Stylesheets v1.75.2 .\" Date: 2011-01-01 .\" Manual: RabbitMQ C Client .\" Source: RabbitMQ C Client .\" Language: English .\" .TH "AMQP\-CONSUME" "1" "2011\-01\-01" "RabbitMQ C Client" "RabbitMQ C Client" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" amqp-consume \- Consume messages from a queue on an AMQP server .SH "SYNOPSIS" .HP \w'\fBamqp\-consume\fR\ 'u \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 \(lqno ack\(rq mode (a\&.k\&.a\&. auto\-ack mode) can be enable with the \fB\-A\fR option\&. .SH "OPTIONS" .PP \fB\-q\fR, \fB\-\-queue\fR=\fIqueue name\fR .RS 4 The name of the queue to consume messages from\&. .sp If the \fB\-\-queue\fR 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\&. .RE .PP \fB\-e\fR, \fB\-\-exchange\fR=\fIexchange name\fR .RS 4 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\fR option is used to request the creation of an exchange\&. .RE .PP \fB\-r\fR, \fB\-\-routing\-key\fR=\fIrouting key\fR .RS 4 The routing key for binding\&. If omitted, an empty routing key is assumed\&. .RE .PP \fB\-d\fR, \fB\-\-declare\fR .RS 4 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\fR option, but no binding to an exchange is requested with the \fB\-\-exchange\fR option\&. .RE .PP \fB\-A\fR, \fB\-\-no\-ack\fR=\fIrouting key\fR .RS 4 Enable \(lqno ack\(rq mode: The AMQP server will unconditionally acknowledge each message that is delivered, regardless of whether the target command exits successfully or not\&. .RE .SH "EXAMPLES" .PP Consume messages from an existing queue \(lqmyqueue\(rq, and output the message bodies on standard output via \fBcat\fR: .RS 4 .sp .if n \{\ .RS 4 .\} .nf $ \fBamqp\-publish \-q myqueue cat\fR .fi .if n \{\ .RE .\} .RE .PP Bind a new exclusive queue to an exchange \(lqmyexch\(rq, and send each message body to the script myscript, automatically acknowledging them on the server: .RS 4 .sp .if n \{\ .RS 4 .\} .nf $ \fBamqp\-consume \-A \-e myexch \&./myscript\fR .fi .if n \{\ .RE .\} .RE .SH "SEE ALSO" .PP \fBlibrabbitmq-tools\fR(7) describes connection\-related options common to all the RabbitMQ C Client tools\&. .SH "AUTHOR" .PP \fBThe RabbitMQ Team <\fR\fB\m[blue]\fBinfo@rabbitmq\&.com\fR\m[]\fR\fB>\fR