1 <?xml version = "1.0"?>
4 WARNING: Modified from the official 0-9-1 specification XML by
6 confirm.select and confirm.select-ok,
7 exchange.bind and exchange.bind-ok,
8 exchange.unbind and exchange.unbind-ok,
10 the ability for the Server to send basic.ack, basic.nack and
11 basic.cancel to the client, and
12 the un-deprecation of exchange.declare{auto-delete} and exchange.declare{internal}
18 Copyright (c) 2006-2008 Cisco Systems, Credit Suisse, Deutsche Boerse
19 Systems, Envoy Technologies, Inc., Goldman Sachs, IONA Technologies PLC,
20 iMatix Corporation, JPMorgan Chase Bank Inc. N.A, Novell, Rabbit
21 Technologies Ltd., Red Hat, Inc., TWIST Process Innovations Ltd, WS02
22 Inc. and 29West Inc. All rights reserved.
26 Cisco Systems, Credit Suisse, Deutsche Boerse Systems, Envoy Technologies,
27 Inc., Goldman Sachs, IONA Technologies PLC, iMatix Corporation, JPMorgan
28 Chase Bank Inc. N.A, Novell, Rabbit Technologies Ltd., Red Hat, Inc.,
29 TWIST Process Innovations Ltd, WS02, Inc. and 29West Inc. (collectively,
30 the "Authors") each hereby grants to you a worldwide, perpetual,
31 royalty-free, nontransferable, nonexclusive license to (i) copy, display,
32 distribute and implement the Advanced Messaging Queue Protocol ("AMQP")
33 Specification and (ii) the Licensed Claims that are held by the Authors,
34 all for the purpose of implementing the Advanced Messaging Queue Protocol
35 Specification. Your license and any rights under this Agreement will
36 terminate immediately without notice from any Author if you bring any
37 claim, suit, demand, or action related to the Advanced Messaging Queue
38 Protocol Specification against any Author. Upon termination, you shall
39 destroy all copies of the Advanced Messaging Queue Protocol Specification
40 in your possession or control.
42 As used hereunder, "Licensed Claims" means those claims of a patent or
43 patent application, throughout the world, excluding design patents and
44 design registrations, owned or controlled, or that can be sublicensed
45 without fee and in compliance with the requirements of this Agreement,
46 by an Author or its affiliates now or at any future time and which would
47 necessarily be infringed by implementation of the Advanced Messaging
48 Queue Protocol Specification. A claim is necessarily infringed hereunder
49 only when it is not possible to avoid infringing it because there is no
50 plausible non-infringing alternative for implementing the required
51 portions of the Advanced Messaging Queue Protocol Specification.
52 Notwithstanding the foregoing, Licensed Claims shall not include any
53 claims other than as set forth above even if contained in the same patent
54 as Licensed Claims; or that read solely on any implementations of any
55 portion of the Advanced Messaging Queue Protocol Specification that are
56 not required by the Advanced Messaging Queue ProtocolSpecification, or
57 that, if licensed, would require a payment of royalties by the licensor
58 to unaffiliated third parties. Moreover, Licensed Claims shall not
59 include (i) any enabling technologies that may be necessary to make or
60 use any Licensed Product but are not themselves expressly set forth in
61 the Advanced Messaging Queue Protocol Specification (e.g., semiconductor
62 manufacturing technology, compiler technology, object oriented
63 technology, networking technology, operating system technology, and the
64 like); or (ii) the implementation of other published standards developed
65 elsewhere and merely referred to in the body of the Advanced Messaging
66 Queue Protocol Specification, or (iii) any Licensed Product and any
67 combinations thereof the purpose or function of which is not required
68 for compliance with the Advanced Messaging Queue Protocol Specification.
69 For purposes of this definition, the Advanced Messaging Queue Protocol
70 Specification shall be deemed to include both architectural and
71 interconnection requirements essential for interoperability and may also
72 include supporting source code artifacts where such architectural,
73 interconnection requirements and source code artifacts are expressly
74 identified as being required or documentation to achieve compliance with
75 the Advanced Messaging Queue Protocol Specification.
77 As used hereunder, "Licensed Products" means only those specific portions
78 of products (hardware, software or combinations thereof) that implement
79 and are compliant with all relevant portions of the Advanced Messaging
80 Queue Protocol Specification.
82 The following disclaimers, which you hereby also acknowledge as to any
83 use you may make of the Advanced Messaging Queue Protocol Specification:
85 THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION IS PROVIDED "AS IS,"
86 AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
87 IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
88 FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
89 CONTENTS OF THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION ARE
90 SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF THE ADVANCED
91 MESSAGING QUEUE PROTOCOL SPECIFICATION WILL NOT INFRINGE ANY THIRD PARTY
92 PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
94 THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
95 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
96 USE, IMPLEMENTATION OR DISTRIBUTION OF THE ADVANCED MESSAGING QUEUE
97 PROTOCOL SPECIFICATION.
99 The name and trademarks of the Authors may NOT be used in any manner,
100 including advertising or publicity pertaining to the Advanced Messaging
101 Queue Protocol Specification or its contents without specific, written
102 prior permission. Title to copyright in the Advanced Messaging Queue
103 Protocol Specification will at all times remain with the Authors.
105 No other rights are granted by implication, estoppel or otherwise.
107 Upon termination of your license or rights under this Agreement, you
108 shall destroy all copies of the Advanced Messaging Queue Protocol
109 Specification in your possession or control.
113 JPMorgan, JPMorgan Chase, Chase, the JPMorgan Chase logo and the
114 Octagon Symbol are trademarks of JPMorgan Chase & Co.
116 IMATIX and the iMatix logo are trademarks of iMatix Corporation sprl.
118 IONA, IONA Technologies, and the IONA logos are trademarks of IONA
119 Technologies PLC and/or its subsidiaries.
121 LINUX is a trademark of Linus Torvalds. RED HAT and JBOSS are registered
122 trademarks of Red Hat, Inc. in the US and other countries.
124 Java, all Java-based trademarks and OpenOffice.org are trademarks of
125 Sun Microsystems, Inc. in the United States, other countries, or both.
127 Other company, product, or service names may be trademarks or service
130 Links to full AMQP specification:
131 =================================
136 <!DOCTYPE amqp SYSTEM "amqp.dtd">
141 We use entities to indicate repetition; attributes to indicate properties.
143 We use the 'name' attribute as an identifier, usually within the context
144 of the surrounding entities.
146 We use spaces to seperate words in names, so that we can print names in
147 their natural form depending on the context - underlines for source code,
148 hyphens for written text, etc.
150 We do not enforce any particular validation mechanism but we support all
151 mechanisms. The protocol definition conforms to a formal grammar that is
152 published seperately in several technologies.
156 <amqp major = "0" minor = "9" revision = "1"
157 port = "5672" comment = "AMQ Protocol version 0-9-1">
159 ======================================================
161 ======================================================
164 <constant name = "frame-method" value = "1" />
165 <constant name = "frame-header" value = "2" />
166 <constant name = "frame-body" value = "3" />
167 <constant name = "frame-heartbeat" value = "8" />
169 <!-- Protocol constants -->
170 <constant name = "frame-min-size" value = "4096" />
171 <constant name = "frame-end" value = "206" />
174 <constant name = "reply-success" value = "200">
176 Indicates that the method completed successfully. This reply code is
177 reserved for future use - the current protocol design does not use positive
178 confirmation and reply codes are sent only in case of an error.
182 <constant name = "content-too-large" value = "311" class = "soft-error">
184 The client attempted to transfer content larger than the server could accept
185 at the present time. The client may retry at a later time.
189 <constant name = "no-consumers" value = "313" class = "soft-error">
191 When the exchange cannot deliver to a consumer when the immediate flag is
192 set. As a result of pending data on the queue or the absence of any
193 consumers of the queue.
197 <constant name = "connection-forced" value = "320" class = "hard-error">
199 An operator intervened to close the connection for some reason. The client
200 may retry at some later date.
204 <constant name = "invalid-path" value = "402" class = "hard-error">
206 The client tried to work with an unknown virtual host.
210 <constant name = "access-refused" value = "403" class = "soft-error">
212 The client attempted to work with a server entity to which it has no
213 access due to security settings.
217 <constant name = "not-found" value = "404" class = "soft-error">
219 The client attempted to work with a server entity that does not exist.
223 <constant name = "resource-locked" value = "405" class = "soft-error">
225 The client attempted to work with a server entity to which it has no
226 access because another client is working with it.
230 <constant name = "precondition-failed" value = "406" class = "soft-error">
232 The client requested a method that was not allowed because some precondition
237 <constant name = "frame-error" value = "501" class = "hard-error">
239 The sender sent a malformed frame that the recipient could not decode.
240 This strongly implies a programming error in the sending peer.
244 <constant name = "syntax-error" value = "502" class = "hard-error">
246 The sender sent a frame that contained illegal values for one or more
247 fields. This strongly implies a programming error in the sending peer.
251 <constant name = "command-invalid" value = "503" class = "hard-error">
253 The client sent an invalid sequence of frames, attempting to perform an
254 operation that was considered invalid by the server. This usually implies
255 a programming error in the client.
259 <constant name = "channel-error" value = "504" class = "hard-error">
261 The client attempted to work with a channel that had not been correctly
262 opened. This most likely indicates a fault in the client layer.
266 <constant name = "unexpected-frame" value = "505" class = "hard-error">
268 The peer sent a frame that was not expected, usually in the context of
269 a content header and body. This strongly indicates a fault in the peer's
274 <constant name = "resource-error" value = "506" class = "hard-error">
276 The server could not complete the method because it lacked sufficient
277 resources. This may be due to the client creating too many of some type
282 <constant name = "not-allowed" value = "530" class = "hard-error">
284 The client tried to work with some entity in a manner that is prohibited
285 by the server, due to security settings or by some other criteria.
289 <constant name = "not-implemented" value = "540" class = "hard-error">
291 The client tried to use functionality that is not implemented in the
296 <constant name = "internal-error" value = "541" class = "hard-error">
298 The server could not complete the method because of an internal error.
299 The server may require intervention by an operator in order to resume
305 ======================================================
307 ======================================================
310 <domain name = "class-id" type = "short" />
312 <domain name = "consumer-tag" type = "shortstr" label = "consumer tag">
314 Identifier for the consumer, valid within the current channel.
318 <domain name = "delivery-tag" type = "longlong" label = "server-assigned delivery tag">
320 The server-assigned and channel-specific delivery tag
322 <rule name = "channel-local">
324 The delivery tag is valid only within the channel from which the message was
325 received. I.e. a client MUST NOT receive a message on one channel and then
326 acknowledge it on another.
329 <rule name = "non-zero">
331 The server MUST NOT use a zero value for delivery tags. Zero is reserved
332 for client use, meaning "all messages so far received".
337 <domain name = "exchange-name" type = "shortstr" label = "exchange name">
339 The exchange name is a client-selected string that identifies the exchange for
342 <assert check = "length" value = "127" />
343 <assert check = "regexp" value = "^[a-zA-Z0-9-_.:]*$" />
346 <domain name = "method-id" type = "short" />
348 <domain name = "no-ack" type = "bit" label = "no acknowledgement needed">
350 If this field is set the server does not expect acknowledgements for
351 messages. That is, when a message is delivered to the client the server
352 assumes the delivery will succeed and immediately dequeues it. This
353 functionality may increase performance but at the cost of reliability.
354 Messages can get lost if a client dies before they are delivered to the
359 <domain name = "no-local" type = "bit" label = "do not deliver own messages">
361 If the no-local field is set the server will not send messages to the connection that
366 <domain name = "no-wait" type = "bit" label = "do not send reply method">
368 If set, the server will not respond to the method. The client should not wait
369 for a reply method. If the server could not complete the method it will raise a
370 channel or connection exception.
374 <domain name = "path" type = "shortstr">
378 <assert check = "notnull" />
379 <assert check = "length" value = "127" />
382 <domain name = "peer-properties" type = "table">
384 This table provides a set of peer properties, used for identification, debugging,
385 and general information.
389 <domain name = "queue-name" type = "shortstr" label = "queue name">
391 The queue name identifies the queue within the vhost. In methods where the queue
392 name may be blank, and that has no specific significance, this refers to the
393 'current' queue for the channel, meaning the last queue that the client declared
394 on the channel. If the client did not declare a queue, and the method needs a
395 queue name, this will result in a 502 (syntax error) channel exception.
397 <assert check = "length" value = "127" />
398 <assert check = "regexp" value = "^[a-zA-Z0-9-_.:]*$" />
401 <domain name = "redelivered" type = "bit" label = "message is being redelivered">
403 This indicates that the message has been previously delivered to this or
406 <rule name = "implementation">
408 The server SHOULD try to signal redelivered messages when it can. When
409 redelivering a message that was not successfully acknowledged, the server
410 SHOULD deliver it to the original client if possible.
412 <doc type = "scenario">
413 Declare a shared queue and publish a message to the queue. Consume the
414 message using explicit acknowledgements, but do not acknowledge the
415 message. Close the connection, reconnect, and consume from the queue
416 again. The message should arrive with the redelivered flag set.
419 <rule name = "hinting">
421 The client MUST NOT rely on the redelivered field but should take it as a
422 hint that the message may already have been processed. A fully robust
423 client must be able to track duplicate received messages on non-transacted,
424 and locally-transacted channels.
429 <domain name = "message-count" type = "long" label = "number of messages in queue">
431 The number of messages in the queue, which will be zero for newly-declared
432 queues. This is the number of messages present in the queue, and committed
433 if the channel on which they were published is transacted, that are not
434 waiting acknowledgement.
438 <domain name = "reply-code" type = "short" label = "reply code from server">
440 The reply code. The AMQ reply codes are defined as constants at the start
441 of this formal specification.
443 <assert check = "notnull" />
446 <domain name = "reply-text" type = "shortstr" label = "localised reply text">
448 The localised reply text. This text can be logged as an aid to resolving
451 <assert check = "notnull" />
454 <!-- Elementary domains -->
455 <domain name = "bit" type = "bit" label = "single bit" />
456 <domain name = "octet" type = "octet" label = "single octet" />
457 <domain name = "short" type = "short" label = "16-bit integer" />
458 <domain name = "long" type = "long" label = "32-bit integer" />
459 <domain name = "longlong" type = "longlong" label = "64-bit integer" />
460 <domain name = "shortstr" type = "shortstr" label = "short string" />
461 <domain name = "longstr" type = "longstr" label = "long string" />
462 <domain name = "timestamp" type = "timestamp" label = "64-bit timestamp" />
463 <domain name = "table" type = "table" label = "field table" />
465 <!-- == CONNECTION ======================================================= -->
467 <class name = "connection" handler = "connection" index = "10" label = "work with socket connections">
469 The connection class provides methods for a client to establish a network connection to
470 a server, and for both peers to operate the connection thereafter.
473 <doc type = "grammar">
474 connection = open-connection *use-connection close-connection
475 open-connection = C:protocol-header
480 challenge = S:SECURE C:SECURE-OK
481 use-connection = *channel
482 close-connection = C:CLOSE S:CLOSE-OK
486 <chassis name = "server" implement = "MUST" />
487 <chassis name = "client" implement = "MUST" />
489 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
491 <method name = "start" synchronous = "1" index = "10" label = "start connection negotiation">
493 This method starts the connection negotiation process by telling the client the
494 protocol version that the server proposes, along with a list of security mechanisms
495 which the client can use for authentication.
498 <rule name = "protocol-name">
500 If the server cannot support the protocol specified in the protocol header,
501 it MUST respond with a valid protocol header and then close the socket
504 <doc type = "scenario">
505 The client sends a protocol header containing an invalid protocol name.
506 The server MUST respond by sending a valid protocol header and then closing
510 <rule name = "server-support">
512 The server MUST provide a protocol version that is lower than or equal to
513 that requested by the client in the protocol header.
515 <doc type = "scenario">
516 The client requests a protocol version that is higher than any valid
517 implementation, e.g. 2.0. The server must respond with a protocol header
518 indicating its supported protocol version, e.g. 1.0.
521 <rule name = "client-support">
523 If the client cannot handle the protocol version suggested by the server
524 it MUST close the socket connection without sending any further data.
526 <doc type = "scenario">
527 The server sends a protocol version that is lower than any valid
528 implementation, e.g. 0.1. The client must respond by closing the
529 connection without sending any further data.
533 <chassis name = "client" implement = "MUST" />
534 <response name = "start-ok" />
536 <field name = "version-major" domain = "octet" label = "protocol major version">
538 The major version number can take any value from 0 to 99 as defined in the
543 <field name = "version-minor" domain = "octet" label = "protocol minor version">
545 The minor version number can take any value from 0 to 99 as defined in the
550 <field name = "server-properties" domain = "peer-properties" label = "server properties">
551 <rule name = "required-fields">
553 The properties SHOULD contain at least these fields: "host", specifying the
554 server host name or address, "product", giving the name of the server product,
555 "version", giving the name of the server version, "platform", giving the name
556 of the operating system, "copyright", if appropriate, and "information", giving
557 other general information.
559 <doc type = "scenario">
560 Client connects to server and inspects the server properties. It checks for
561 the presence of the required fields.
566 <field name = "mechanisms" domain = "longstr" label = "available security mechanisms">
568 A list of the security mechanisms that the server supports, delimited by spaces.
570 <assert check = "notnull" />
573 <field name = "locales" domain = "longstr" label = "available message locales">
575 A list of the message locales that the server supports, delimited by spaces. The
576 locale defines the language in which the server will send reply texts.
578 <rule name = "required-support">
580 The server MUST support at least the en_US locale.
582 <doc type = "scenario">
583 Client connects to server and inspects the locales field. It checks for
584 the presence of the required locale(s).
587 <assert check = "notnull" />
591 <method name = "start-ok" synchronous = "1" index = "11"
592 label = "select security mechanism and locale">
594 This method selects a SASL security mechanism.
597 <chassis name = "server" implement = "MUST" />
599 <field name = "client-properties" domain = "peer-properties" label = "client properties">
600 <rule name = "required-fields">
601 <!-- This rule is not testable from the client side -->
603 The properties SHOULD contain at least these fields: "product", giving the name
604 of the client product, "version", giving the name of the client version, "platform",
605 giving the name of the operating system, "copyright", if appropriate, and
606 "information", giving other general information.
611 <field name = "mechanism" domain = "shortstr" label = "selected security mechanism">
613 A single security mechanisms selected by the client, which must be one of those
614 specified by the server.
616 <rule name = "security">
618 The client SHOULD authenticate using the highest-level security profile it
619 can handle from the list provided by the server.
622 <rule name = "validity">
624 If the mechanism field does not contain one of the security mechanisms
625 proposed by the server in the Start method, the server MUST close the
626 connection without sending any further data.
628 <doc type = "scenario">
629 Client connects to server and sends an invalid security mechanism. The
630 server must respond by closing the connection (a socket close, with no
631 connection close negotiation).
634 <assert check = "notnull" />
637 <field name = "response" domain = "longstr" label = "security response data">
639 A block of opaque data passed to the security mechanism. The contents of this
640 data are defined by the SASL security mechanism.
642 <assert check = "notnull" />
645 <field name = "locale" domain = "shortstr" label = "selected message locale">
647 A single message locale selected by the client, which must be one of those
648 specified by the server.
650 <assert check = "notnull" />
654 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
656 <method name = "secure" synchronous = "1" index = "20" label = "security mechanism challenge">
658 The SASL protocol works by exchanging challenges and responses until both peers have
659 received sufficient information to authenticate each other. This method challenges
660 the client to provide more information.
663 <chassis name = "client" implement = "MUST" />
664 <response name = "secure-ok" />
666 <field name = "challenge" domain = "longstr" label = "security challenge data">
668 Challenge information, a block of opaque binary data passed to the security
674 <method name = "secure-ok" synchronous = "1" index = "21" label = "security mechanism response">
676 This method attempts to authenticate, passing a block of SASL data for the security
677 mechanism at the server side.
680 <chassis name = "server" implement = "MUST" />
682 <field name = "response" domain = "longstr" label = "security response data">
684 A block of opaque data passed to the security mechanism. The contents of this
685 data are defined by the SASL security mechanism.
687 <assert check = "notnull" />
691 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
693 <method name = "tune" synchronous = "1" index = "30"
694 label = "propose connection tuning parameters">
696 This method proposes a set of connection configuration values to the client. The
697 client can accept and/or adjust these.
700 <chassis name = "client" implement = "MUST" />
702 <response name = "tune-ok" />
704 <field name = "channel-max" domain = "short" label = "proposed maximum channels">
706 Specifies highest channel number that the server permits. Usable channel numbers
707 are in the range 1..channel-max. Zero indicates no specified limit.
711 <field name = "frame-max" domain = "long" label = "proposed maximum frame size">
713 The largest frame size that the server proposes for the connection, including
714 frame header and end-byte. The client can negotiate a lower value. Zero means
715 that the server does not impose any specific limit but may reject very large
716 frames if it cannot allocate resources for them.
718 <rule name = "minimum">
720 Until the frame-max has been negotiated, both peers MUST accept frames of up
721 to frame-min-size octets large, and the minimum negotiated value for frame-max
722 is also frame-min-size.
724 <doc type = "scenario">
725 Client connects to server and sends a large properties field, creating a frame
726 of frame-min-size octets. The server must accept this frame.
731 <field name = "heartbeat" domain = "short" label = "desired heartbeat delay">
733 The delay, in seconds, of the connection heartbeat that the server wants.
734 Zero means the server does not want a heartbeat.
739 <method name = "tune-ok" synchronous = "1" index = "31"
740 label = "negotiate connection tuning parameters">
742 This method sends the client's connection tuning parameters to the server.
743 Certain fields are negotiated, others provide capability information.
746 <chassis name = "server" implement = "MUST" />
748 <field name = "channel-max" domain = "short" label = "negotiated maximum channels">
750 The maximum total number of channels that the client will use per connection.
752 <rule name = "upper-limit">
754 If the client specifies a channel max that is higher than the value provided
755 by the server, the server MUST close the connection without attempting a
756 negotiated close. The server may report the error in some fashion to assist
760 <assert check = "notnull" />
761 <assert check = "le" method = "tune" field = "channel-max" />
764 <field name = "frame-max" domain = "long" label = "negotiated maximum frame size">
766 The largest frame size that the client and server will use for the connection.
767 Zero means that the client does not impose any specific limit but may reject
768 very large frames if it cannot allocate resources for them. Note that the
769 frame-max limit applies principally to content frames, where large contents can
770 be broken into frames of arbitrary size.
772 <rule name = "minimum">
774 Until the frame-max has been negotiated, both peers MUST accept frames of up
775 to frame-min-size octets large, and the minimum negotiated value for frame-max
776 is also frame-min-size.
779 <rule name = "upper-limit">
781 If the client specifies a frame max that is higher than the value provided
782 by the server, the server MUST close the connection without attempting a
783 negotiated close. The server may report the error in some fashion to assist
789 <field name = "heartbeat" domain = "short" label = "desired heartbeat delay">
791 The delay, in seconds, of the connection heartbeat that the client wants. Zero
792 means the client does not want a heartbeat.
797 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
799 <method name = "open" synchronous = "1" index = "40" label = "open connection to virtual host">
801 This method opens a connection to a virtual host, which is a collection of
802 resources, and acts to separate multiple application domains within a server.
803 The server may apply arbitrary limits per virtual host, such as the number
804 of each type of entity that may be used, per connection and/or in total.
807 <chassis name = "server" implement = "MUST" />
808 <response name = "open-ok" />
810 <field name = "virtual-host" domain = "path" label = "virtual host name">
812 The name of the virtual host to work with.
814 <rule name = "separation">
816 If the server supports multiple virtual hosts, it MUST enforce a full
817 separation of exchanges, queues, and all associated entities per virtual
818 host. An application, connected to a specific virtual host, MUST NOT be able
819 to access resources of another virtual host.
822 <rule name = "security">
824 The server SHOULD verify that the client has permission to access the
825 specified virtual host.
829 <!-- Deprecated: "capabilities", must be zero -->
830 <field name = "reserved-1" type = "shortstr" reserved = "1" />
831 <!-- Deprecated: "insist", must be zero -->
832 <field name = "reserved-2" type = "bit" reserved = "1" />
835 <method name = "open-ok" synchronous = "1" index = "41" label = "signal that connection is ready">
837 This method signals to the client that the connection is ready for use.
839 <chassis name = "client" implement = "MUST" />
840 <!-- Deprecated: "known-hosts", must be zero -->
841 <field name = "reserved-1" type = "shortstr" reserved = "1" />
844 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
846 <method name = "close" synchronous = "1" index = "50" label = "request a connection close">
848 This method indicates that the sender wants to close the connection. This may be
849 due to internal conditions (e.g. a forced shut-down) or due to an error handling
850 a specific method, i.e. an exception. When a close is due to an exception, the
851 sender provides the class and method id of the method which caused the exception.
853 <rule name = "stability">
855 After sending this method, any received methods except Close and Close-OK MUST
856 be discarded. The response to receiving a Close after sending Close must be to
861 <chassis name = "client" implement = "MUST" />
862 <chassis name = "server" implement = "MUST" />
863 <response name = "close-ok" />
865 <field name = "reply-code" domain = "reply-code" />
866 <field name = "reply-text" domain = "reply-text" />
868 <field name = "class-id" domain = "class-id" label = "failing method class">
870 When the close is provoked by a method exception, this is the class of the
875 <field name = "method-id" domain = "method-id" label = "failing method ID">
877 When the close is provoked by a method exception, this is the ID of the method.
882 <method name = "close-ok" synchronous = "1" index = "51" label = "confirm a connection close">
884 This method confirms a Connection.Close method and tells the recipient that it is
885 safe to release resources for the connection and close the socket.
887 <rule name = "reporting">
889 A peer that detects a socket closure without having received a Close-Ok
890 handshake method SHOULD log the error.
893 <chassis name = "client" implement = "MUST" />
894 <chassis name = "server" implement = "MUST" />
898 <!-- == CHANNEL ========================================================== -->
900 <class name = "channel" handler = "channel" index = "20" label = "work with channels">
902 The channel class provides methods for a client to establish a channel to a
903 server and for both peers to operate the channel thereafter.
906 <doc type = "grammar">
907 channel = open-channel *use-channel close-channel
908 open-channel = C:OPEN S:OPEN-OK
909 use-channel = C:FLOW S:FLOW-OK
912 close-channel = C:CLOSE S:CLOSE-OK
916 <chassis name = "server" implement = "MUST" />
917 <chassis name = "client" implement = "MUST" />
919 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
921 <method name = "open" synchronous = "1" index = "10" label = "open a channel for use">
923 This method opens a channel to the server.
925 <rule name = "state" on-failure = "channel-error">
927 The client MUST NOT use this method on an already-opened channel.
929 <doc type = "scenario">
930 Client opens a channel and then reopens the same channel.
933 <chassis name = "server" implement = "MUST" />
934 <response name = "open-ok" />
935 <!-- Deprecated: "out-of-band", must be zero -->
936 <field name = "reserved-1" type = "shortstr" reserved = "1" />
939 <method name = "open-ok" synchronous = "1" index = "11" label = "signal that the channel is ready">
941 This method signals to the client that the channel is ready for use.
943 <chassis name = "client" implement = "MUST" />
944 <!-- Deprecated: "channel-id", must be zero -->
945 <field name = "reserved-1" type = "longstr" reserved = "1" />
948 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
950 <method name = "flow" synchronous = "1" index = "20" label = "enable/disable flow from peer">
952 This method asks the peer to pause or restart the flow of content data sent by
953 a consumer. This is a simple flow-control mechanism that a peer can use to avoid
954 overflowing its queues or otherwise finding itself receiving more messages than
955 it can process. Note that this method is not intended for window control. It does
956 not affect contents returned by Basic.Get-Ok methods.
959 <rule name = "initial-state">
961 When a new channel is opened, it is active (flow is active). Some applications
962 assume that channels are inactive until started. To emulate this behaviour a
963 client MAY open the channel, then pause it.
967 <rule name = "bidirectional">
969 When sending content frames, a peer SHOULD monitor the channel for incoming
970 methods and respond to a Channel.Flow as rapidly as possible.
974 <rule name = "throttling">
976 A peer MAY use the Channel.Flow method to throttle incoming content data for
977 internal reasons, for example, when exchanging data over a slower connection.
981 <rule name = "expected-behaviour">
983 The peer that requests a Channel.Flow method MAY disconnect and/or ban a peer
984 that does not respect the request. This is to prevent badly-behaved clients
985 from overwhelming a server.
989 <chassis name = "server" implement = "MUST" />
990 <chassis name = "client" implement = "MUST" />
992 <response name = "flow-ok" />
994 <field name = "active" domain = "bit" label = "start/stop content frames">
996 If 1, the peer starts sending content frames. If 0, the peer stops sending
1002 <method name = "flow-ok" index = "21" label = "confirm a flow method">
1004 Confirms to the peer that a flow command was received and processed.
1006 <chassis name = "server" implement = "MUST" />
1007 <chassis name = "client" implement = "MUST" />
1008 <field name = "active" domain = "bit" label = "current flow setting">
1010 Confirms the setting of the processed flow method: 1 means the peer will start
1011 sending or continue to send content frames; 0 means it will not.
1016 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1018 <method name = "close" synchronous = "1" index = "40" label = "request a channel close">
1020 This method indicates that the sender wants to close the channel. This may be due to
1021 internal conditions (e.g. a forced shut-down) or due to an error handling a specific
1022 method, i.e. an exception. When a close is due to an exception, the sender provides
1023 the class and method id of the method which caused the exception.
1025 <rule name = "stability">
1027 After sending this method, any received methods except Close and Close-OK MUST
1028 be discarded. The response to receiving a Close after sending Close must be to
1033 <chassis name = "client" implement = "MUST" />
1034 <chassis name = "server" implement = "MUST" />
1035 <response name = "close-ok" />
1037 <field name = "reply-code" domain = "reply-code" />
1038 <field name = "reply-text" domain = "reply-text" />
1040 <field name = "class-id" domain = "class-id" label = "failing method class">
1042 When the close is provoked by a method exception, this is the class of the
1047 <field name = "method-id" domain = "method-id" label = "failing method ID">
1049 When the close is provoked by a method exception, this is the ID of the method.
1054 <method name = "close-ok" synchronous = "1" index = "41" label = "confirm a channel close">
1056 This method confirms a Channel.Close method and tells the recipient that it is safe
1057 to release resources for the channel.
1059 <rule name = "reporting">
1061 A peer that detects a socket closure without having received a Channel.Close-Ok
1062 handshake method SHOULD log the error.
1065 <chassis name = "client" implement = "MUST" />
1066 <chassis name = "server" implement = "MUST" />
1070 <!-- == EXCHANGE ========================================================= -->
1072 <class name = "exchange" handler = "channel" index = "40" label = "work with exchanges">
1074 Exchanges match and distribute messages across queues. Exchanges can be configured in
1075 the server or declared at runtime.
1078 <doc type = "grammar">
1079 exchange = C:DECLARE S:DECLARE-OK
1080 / C:DELETE S:DELETE-OK
1082 / C:UNBIND S:UNBIND-OK
1085 <chassis name = "server" implement = "MUST" />
1086 <chassis name = "client" implement = "MUST" />
1088 <rule name = "required-types">
1090 The server MUST implement these standard exchange types: fanout, direct.
1092 <doc type = "scenario">
1093 Client attempts to declare an exchange with each of these standard types.
1096 <rule name = "recommended-types">
1098 The server SHOULD implement these standard exchange types: topic, headers.
1100 <doc type = "scenario">
1101 Client attempts to declare an exchange with each of these standard types.
1104 <rule name = "required-instances">
1106 The server MUST, in each virtual host, pre-declare an exchange instance
1107 for each standard exchange type that it implements, where the name of the
1108 exchange instance, if defined, is "amq." followed by the exchange type name.
1111 The server MUST, in each virtual host, pre-declare at least two direct
1112 exchange instances: one named "amq.direct", the other with no public name
1113 that serves as a default exchange for Publish methods.
1115 <doc type = "scenario">
1116 Client declares a temporary queue and attempts to bind to each required
1117 exchange instance ("amq.fanout", "amq.direct", "amq.topic", and "amq.headers"
1118 if those types are defined).
1121 <rule name = "default-exchange">
1123 The server MUST pre-declare a direct exchange with no public name to act as
1124 the default exchange for content Publish methods and for default queue bindings.
1126 <doc type = "scenario">
1127 Client checks that the default exchange is active by specifying a queue
1128 binding with no exchange name, and publishing a message with a suitable
1129 routing key but without specifying the exchange name, then ensuring that
1130 the message arrives in the queue correctly.
1133 <rule name = "default-access">
1135 The server MUST NOT allow clients to access the default exchange except
1136 by specifying an empty exchange name in the Queue.Bind and content Publish
1140 <rule name = "extensions">
1142 The server MAY implement other exchange types as wanted.
1146 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1148 <method name = "declare" synchronous = "1" index = "10" label = "verify exchange exists, create if needed">
1150 This method creates an exchange if it does not already exist, and if the exchange
1151 exists, verifies that it is of the correct and expected class.
1153 <rule name = "minimum">
1155 The server SHOULD support a minimum of 16 exchanges per virtual host and
1156 ideally, impose no limit except as defined by available resources.
1158 <doc type = "scenario">
1159 The client declares as many exchanges as it can until the server reports
1160 an error; the number of exchanges successfully declared must be at least
1165 <chassis name = "server" implement = "MUST" />
1166 <response name = "declare-ok" />
1168 <!-- Deprecated: "ticket", must be zero -->
1169 <field name = "reserved-1" type = "short" reserved = "1" />
1171 <field name = "exchange" domain = "exchange-name">
1172 <rule name = "reserved" on-failure = "access-refused">
1174 Exchange names starting with "amq." are reserved for pre-declared and
1175 standardised exchanges. The client MAY declare an exchange starting with
1176 "amq." if the passive option is set, or the exchange already exists.
1178 <doc type = "scenario">
1179 The client attempts to declare a non-existing exchange starting with
1180 "amq." and with the passive option set to zero.
1183 <rule name = "syntax" on-failure = "precondition-failed">
1185 The exchange name consists of a non-empty sequence of these characters:
1186 letters, digits, hyphen, underscore, period, or colon.
1188 <doc type = "scenario">
1189 The client attempts to declare an exchange with an illegal name.
1192 <assert check = "notnull" />
1195 <field name = "type" domain = "shortstr" label = "exchange type">
1197 Each exchange belongs to one of a set of exchange types implemented by the
1198 server. The exchange types define the functionality of the exchange - i.e. how
1199 messages are routed through it. It is not valid or meaningful to attempt to
1200 change the type of an existing exchange.
1202 <rule name = "typed" on-failure = "not-allowed">
1204 Exchanges cannot be redeclared with different types. The client MUST not
1205 attempt to redeclare an existing exchange with a different type than used
1206 in the original Exchange.Declare method.
1208 <doc type = "scenario">
1212 <rule name = "support" on-failure = "command-invalid">
1214 The client MUST NOT attempt to declare an exchange with a type that the
1215 server does not support.
1217 <doc type = "scenario">
1223 <field name = "passive" domain = "bit" label = "do not create exchange">
1225 If set, the server will reply with Declare-Ok if the exchange already
1226 exists with the same name, and raise an error if not. The client can
1227 use this to check whether an exchange exists without modifying the
1228 server state. When set, all other method fields except name and no-wait
1229 are ignored. A declare with both passive and no-wait has no effect.
1230 Arguments are compared for semantic equivalence.
1232 <rule name = "not-found">
1234 If set, and the exchange does not already exist, the server MUST
1235 raise a channel exception with reply code 404 (not found).
1237 <doc type = "scenario">
1241 <rule name = "equivalent">
1243 If not set and the exchange exists, the server MUST check that the
1244 existing exchange has the same values for type, durable, and arguments
1245 fields. The server MUST respond with Declare-Ok if the requested
1246 exchange matches these fields, and MUST raise a channel exception if
1249 <doc type = "scenario">
1255 <field name = "durable" domain = "bit" label = "request a durable exchange">
1257 If set when creating a new exchange, the exchange will be marked as durable.
1258 Durable exchanges remain active when a server restarts. Non-durable exchanges
1259 (transient exchanges) are purged if/when a server restarts.
1261 <rule name = "support">
1263 The server MUST support both durable and transient exchanges.
1265 <doc type = "scenario">
1271 <field name = "auto-delete" domain = "bit" label = "auto-delete when unused">
1273 If set, the exchange is deleted when all queues have
1276 <rule name = "amq_exchange_02">
1278 The server SHOULD allow for a reasonable delay between the
1279 point when it determines that an exchange is not being
1280 used (or no longer used), and the point when it deletes
1281 the exchange. At the least it must allow a client to
1282 create an exchange and then bind a queue to it, with a
1283 small but non-zero delay between these two actions.
1286 <rule name = "amq_exchange_25">
1288 The server MUST ignore the auto-delete field if the
1289 exchange already exists.
1294 <field name = "internal" domain = "bit" label = "create internal exchange">
1296 If set, the exchange may not be used directly by publishers,
1297 but only when bound to other exchanges. Internal exchanges
1298 are used to construct wiring that is not visible to
1303 <field name = "no-wait" domain = "no-wait" />
1305 <field name = "arguments" domain = "table" label = "arguments for declaration">
1307 A set of arguments for the declaration. The syntax and semantics of these
1308 arguments depends on the server implementation.
1313 <method name = "declare-ok" synchronous = "1" index = "11" label = "confirm exchange declaration">
1315 This method confirms a Declare method and confirms the name of the exchange,
1316 essential for automatically-named exchanges.
1318 <chassis name = "client" implement = "MUST" />
1321 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1323 <method name = "delete" synchronous = "1" index = "20" label = "delete an exchange">
1325 This method deletes an exchange. When an exchange is deleted all queue bindings on
1326 the exchange are cancelled.
1329 <chassis name = "server" implement = "MUST" />
1330 <response name = "delete-ok" />
1332 <!-- Deprecated: "ticket", must be zero -->
1333 <field name = "reserved-1" type = "short" reserved = "1" />
1335 <field name = "exchange" domain = "exchange-name">
1336 <rule name = "exists" on-failure = "not-found">
1338 The client MUST NOT attempt to delete an exchange that does not exist.
1341 <assert check = "notnull" />
1344 <field name = "if-unused" domain = "bit" label = "delete only if unused">
1346 If set, the server will only delete the exchange if it has no queue bindings. If
1347 the exchange has queue bindings the server does not delete it but raises a
1348 channel exception instead.
1350 <rule name = "in-use" on-failure = "precondition-failed">
1352 The server MUST NOT delete an exchange that has bindings on it, if the if-unused
1355 <doc type = "scenario">
1356 The client declares an exchange, binds a queue to it, then tries to delete it
1357 setting if-unused to true.
1362 <field name = "no-wait" domain = "no-wait" />
1365 <method name = "delete-ok" synchronous = "1" index = "21"
1366 label = "confirm deletion of an exchange">
1367 <doc>This method confirms the deletion of an exchange.</doc>
1368 <chassis name = "client" implement = "MUST" />
1371 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1373 <method name = "bind" synchronous = "1" index = "30"
1374 label = "bind exchange to an exchange">
1376 <doc>This method binds an exchange to an exchange.</doc>
1378 <rule name = "duplicates">
1380 A server MUST allow and ignore duplicate bindings - that is,
1381 two or more bind methods for a specific exchanges, with
1382 identical arguments - without treating these as an error.
1384 <doc type = "scenario">
1385 A client binds an exchange to an exchange. The client then
1386 repeats the bind (with identical arguments).
1390 <rule name = "cyclical">
1392 A server MUST allow cycles of exchange bindings to be
1393 created including allowing an exchange to be bound to
1396 <doc type = "scenario">
1397 A client declares an exchange and binds it to itself.
1401 <rule name = "unique">
1403 A server MUST not deliver the same message more than once to
1404 a destination exchange, even if the topology of exchanges
1405 and bindings results in multiple (even infinite) routes to
1408 <doc type = "scenario">
1409 A client declares an exchange and binds it using multiple
1410 bindings to the amq.topic exchange. The client then
1411 publishes a message to the amq.topic exchange that matches
1416 <chassis name = "server" implement = "MUST"/>
1418 <response name = "bind-ok"/>
1420 <!-- Deprecated: "ticket", must be zero -->
1421 <field name = "reserved-1" type = "short" reserved = "1"/>
1423 <field name = "destination" domain = "exchange-name"
1424 label = "name of the destination exchange to bind to">
1425 <doc>Specifies the name of the destination exchange to bind.</doc>
1426 <rule name = "exchange-existence" on-failure = "not-found">
1428 A client MUST NOT be allowed to bind a non-existent
1429 destination exchange.
1431 <doc type = "scenario">
1432 A client attempts to bind an undeclared exchange to an
1436 <rule name = "default-exchange">
1438 The server MUST accept a blank exchange name to mean the
1441 <doc type = "scenario">
1442 The client declares an exchange and binds a blank exchange
1448 <field name = "source" domain = "exchange-name"
1449 label = "name of the source exchange to bind to">
1450 <doc>Specifies the name of the source exchange to bind.</doc>
1451 <rule name = "exchange-existence" on-failure = "not-found">
1453 A client MUST NOT be allowed to bind a non-existent source
1456 <doc type = "scenario">
1457 A client attempts to bind an exchange to an undeclared
1461 <rule name = "default-exchange">
1463 The server MUST accept a blank exchange name to mean the
1466 <doc type = "scenario">
1467 The client declares an exchange and binds it to a blank
1473 <field name = "routing-key" domain = "shortstr"
1474 label = "message routing key">
1476 Specifies the routing key for the binding. The routing key
1477 is used for routing messages depending on the exchange
1478 configuration. Not all exchanges use a routing key - refer
1479 to the specific exchange documentation.
1483 <field name = "no-wait" domain = "no-wait"/>
1485 <field name = "arguments" domain = "table"
1486 label = "arguments for binding">
1488 A set of arguments for the binding. The syntax and semantics
1489 of these arguments depends on the exchange class.
1494 <method name="bind-ok" synchronous="1" index="31"
1495 label = "confirm bind successful">
1496 <doc>This method confirms that the bind was successful.</doc>
1498 <chassis name="client" implement="MUST"/>
1501 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1503 <method name = "unbind" synchronous = "1" index = "40"
1504 label = "unbind an exchange from an exchange">
1505 <doc>This method unbinds an exchange from an exchange.</doc>
1507 <doc>If a unbind fails, the server MUST raise a connection exception.</doc>
1509 <chassis name = "server" implement = "MUST"/>
1510 <response name = "unbind-ok"/>
1512 <!-- Deprecated: "ticket", must be zero -->
1513 <field name = "reserved-1" type = "short" reserved = "1"/>
1515 <field name = "destination" domain = "exchange-name">
1516 <doc>Specifies the name of the destination exchange to unbind.</doc>
1517 <rule name = "must-exist" on-failure = "not-found">
1519 The client MUST NOT attempt to unbind an exchange that
1520 does not exist from an exchange.
1522 <doc type = "scenario">
1523 The client attempts to unbind a non-existent exchange from
1527 <rule name = "default-exchange">
1529 The server MUST accept a blank exchange name to mean the
1532 <doc type = "scenario">
1533 The client declares an exchange, binds a blank exchange
1534 name to it, and then unbinds a blank exchange name from
1540 <field name = "source" domain = "exchange-name">
1541 <doc>Specifies the name of the source exchange to unbind.</doc>
1542 <rule name = "must-exist" on-failure = "not-found">
1544 The client MUST NOT attempt to unbind an exchange from an
1545 exchange that does not exist.
1547 <doc type = "scenario">
1548 The client attempts to unbind an exchange from a
1549 non-existent exchange.
1552 <rule name = "default-exchange">
1554 The server MUST accept a blank exchange name to mean the
1557 <doc type = "scenario">
1558 The client declares an exchange, binds an exchange to a
1559 blank exchange name, and then unbinds an exchange from a
1560 black exchange name.
1565 <field name = "routing-key" domain = "shortstr"
1566 label = "routing key of binding">
1567 <doc>Specifies the routing key of the binding to unbind.</doc>
1570 <field name = "no-wait" domain = "no-wait"/>
1572 <field name = "arguments" domain = "table"
1573 label = "arguments of binding">
1574 <doc>Specifies the arguments of the binding to unbind.</doc>
1578 <method name = "unbind-ok" synchronous = "1" index = "51"
1579 label = "confirm unbind successful">
1580 <doc>This method confirms that the unbind was successful.</doc>
1581 <chassis name = "client" implement = "MUST"/>
1586 <!-- == QUEUE ============================================================ -->
1588 <class name = "queue" handler = "channel" index = "50" label = "work with queues">
1590 Queues store and forward messages. Queues can be configured in the server or created at
1591 runtime. Queues must be attached to at least one exchange in order to receive messages
1595 <doc type = "grammar">
1596 queue = C:DECLARE S:DECLARE-OK
1598 / C:UNBIND S:UNBIND-OK
1599 / C:PURGE S:PURGE-OK
1600 / C:DELETE S:DELETE-OK
1603 <chassis name = "server" implement = "MUST" />
1604 <chassis name = "client" implement = "MUST" />
1606 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1608 <method name = "declare" synchronous = "1" index = "10" label = "declare queue, create if needed">
1610 This method creates or checks a queue. When creating a new queue the client can
1611 specify various properties that control the durability of the queue and its
1612 contents, and the level of sharing for the queue.
1615 <rule name = "default-binding">
1617 The server MUST create a default binding for a newly-declared queue to the
1618 default exchange, which is an exchange of type 'direct' and use the queue
1619 name as the routing key.
1621 <doc type = "scenario">
1622 Client declares a new queue, and then without explicitly binding it to an
1623 exchange, attempts to send a message through the default exchange binding,
1624 i.e. publish a message to the empty exchange, with the queue name as routing
1629 <rule name = "minimum-queues">
1631 The server SHOULD support a minimum of 256 queues per virtual host and ideally,
1632 impose no limit except as defined by available resources.
1634 <doc type = "scenario">
1635 Client attempts to declare as many queues as it can until the server reports
1636 an error. The resulting count must at least be 256.
1640 <chassis name = "server" implement = "MUST" />
1641 <response name = "declare-ok" />
1643 <!-- Deprecated: "ticket", must be zero -->
1644 <field name = "reserved-1" type = "short" reserved = "1" />
1646 <field name = "queue" domain = "queue-name">
1647 <rule name = "default-name">
1649 The queue name MAY be empty, in which case the server MUST create a new
1650 queue with a unique generated name and return this to the client in the
1653 <doc type = "scenario">
1654 Client attempts to declare several queues with an empty name. The client then
1655 verifies that the server-assigned names are unique and different.
1658 <rule name = "reserved" on-failure = "access-refused">
1660 Queue names starting with "amq." are reserved for pre-declared and
1661 standardised queues. The client MAY declare a queue starting with
1662 "amq." if the passive option is set, or the queue already exists.
1664 <doc type = "scenario">
1665 The client attempts to declare a non-existing queue starting with
1666 "amq." and with the passive option set to zero.
1669 <rule name = "syntax" on-failure = "precondition-failed">
1671 The queue name can be empty, or a sequence of these characters:
1672 letters, digits, hyphen, underscore, period, or colon.
1674 <doc type = "scenario">
1675 The client attempts to declare a queue with an illegal name.
1680 <field name = "passive" domain = "bit" label = "do not create queue">
1682 If set, the server will reply with Declare-Ok if the queue already
1683 exists with the same name, and raise an error if not. The client can
1684 use this to check whether a queue exists without modifying the
1685 server state. When set, all other method fields except name and no-wait
1686 are ignored. A declare with both passive and no-wait has no effect.
1687 Arguments are compared for semantic equivalence.
1689 <rule name = "passive" on-failure = "not-found">
1691 The client MAY ask the server to assert that a queue exists without
1692 creating the queue if not. If the queue does not exist, the server
1693 treats this as a failure.
1695 <doc type = "scenario">
1696 Client declares an existing queue with the passive option and expects
1697 the server to respond with a declare-ok. Client then attempts to declare
1698 a non-existent queue with the passive option, and the server must close
1699 the channel with the correct reply-code.
1702 <rule name = "equivalent">
1704 If not set and the queue exists, the server MUST check that the
1705 existing queue has the same values for durable, exclusive, auto-delete,
1706 and arguments fields. The server MUST respond with Declare-Ok if the
1707 requested queue matches these fields, and MUST raise a channel exception
1710 <doc type = "scenario">
1716 <field name = "durable" domain = "bit" label = "request a durable queue">
1718 If set when creating a new queue, the queue will be marked as durable. Durable
1719 queues remain active when a server restarts. Non-durable queues (transient
1720 queues) are purged if/when a server restarts. Note that durable queues do not
1721 necessarily hold persistent messages, although it does not make sense to send
1722 persistent messages to a transient queue.
1725 <rule name = "persistence">
1726 <doc>The server MUST recreate the durable queue after a restart.</doc>
1728 <doc type = "scenario">
1729 Client declares a durable queue. The server is then restarted. The client
1730 then attempts to send a message to the queue. The message should be successfully
1735 <rule name = "types">
1736 <doc>The server MUST support both durable and transient queues.</doc>
1737 <doc type = "scenario">
1738 A client declares two named queues, one durable and one transient.
1743 <field name = "exclusive" domain = "bit" label = "request an exclusive queue">
1745 Exclusive queues may only be accessed by the current connection, and are
1746 deleted when that connection closes. Passive declaration of an exclusive
1747 queue by other connections are not allowed.
1750 <rule name = "types">
1752 The server MUST support both exclusive (private) and non-exclusive (shared)
1755 <doc type = "scenario">
1756 A client declares two named queues, one exclusive and one non-exclusive.
1760 <rule name = "exclusive" on-failure = "resource-locked">
1762 The client MAY NOT attempt to use a queue that was declared as exclusive
1763 by another still-open connection.
1765 <doc type = "scenario">
1766 One client declares an exclusive queue. A second client on a different
1767 connection attempts to declare, bind, consume, purge, delete, or declare
1768 a queue of the same name.
1773 <field name = "auto-delete" domain = "bit" label = "auto-delete queue when unused">
1775 If set, the queue is deleted when all consumers have finished using it. The last
1776 consumer can be cancelled either explicitly or because its channel is closed. If
1777 there was no consumer ever on the queue, it won't be deleted. Applications can
1778 explicitly delete auto-delete queues using the Delete method as normal.
1781 <rule name = "pre-existence">
1783 The server MUST ignore the auto-delete field if the queue already exists.
1785 <doc type = "scenario">
1786 Client declares two named queues, one as auto-delete and one explicit-delete.
1787 Client then attempts to declare the two queues using the same names again,
1788 but reversing the value of the auto-delete field in each case. Verify that the
1789 queues still exist with the original auto-delete flag values.
1794 <field name = "no-wait" domain = "no-wait" />
1796 <field name = "arguments" domain = "table" label = "arguments for declaration">
1798 A set of arguments for the declaration. The syntax and semantics of these
1799 arguments depends on the server implementation.
1804 <method name = "declare-ok" synchronous = "1" index = "11" label = "confirms a queue definition">
1806 This method confirms a Declare method and confirms the name of the queue, essential
1807 for automatically-named queues.
1810 <chassis name = "client" implement = "MUST" />
1812 <field name = "queue" domain = "queue-name">
1814 Reports the name of the queue. If the server generated a queue name, this field
1817 <assert check = "notnull" />
1820 <field name = "message-count" domain = "message-count" />
1822 <field name = "consumer-count" domain = "long" label = "number of consumers">
1824 Reports the number of active consumers for the queue. Note that consumers can
1825 suspend activity (Channel.Flow) in which case they do not appear in this count.
1830 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1832 <method name = "bind" synchronous = "1" index = "20" label = "bind queue to an exchange">
1834 This method binds a queue to an exchange. Until a queue is bound it will not
1835 receive any messages. In a classic messaging model, store-and-forward queues
1836 are bound to a direct exchange and subscription queues are bound to a topic
1840 <rule name = "duplicates">
1842 A server MUST allow ignore duplicate bindings - that is, two or more bind
1843 methods for a specific queue, with identical arguments - without treating these
1846 <doc type = "scenario">
1847 A client binds a named queue to an exchange. The client then repeats the bind
1848 (with identical arguments).
1852 <rule name = "unique">
1854 A server MUST not deliver the same message more than once to a queue, even if
1855 the queue has multiple bindings that match the message.
1857 <doc type = "scenario">
1858 A client declares a named queue and binds it using multiple bindings to the
1859 amq.topic exchange. The client then publishes a message that matches all its
1864 <rule name = "transient-exchange">
1866 The server MUST allow a durable queue to bind to a transient exchange.
1868 <doc type = "scenario">
1869 A client declares a transient exchange. The client then declares a named durable
1870 queue and then attempts to bind the transient exchange to the durable queue.
1874 <rule name = "durable-exchange">
1876 Bindings of durable queues to durable exchanges are automatically durable
1877 and the server MUST restore such bindings after a server restart.
1879 <doc type = "scenario">
1880 A server declares a named durable queue and binds it to a durable exchange. The
1881 server is restarted. The client then attempts to use the queue/exchange combination.
1885 <rule name = "binding-count">
1887 The server SHOULD support at least 4 bindings per queue, and ideally, impose no
1888 limit except as defined by available resources.
1890 <doc type = "scenario">
1891 A client declares a named queue and attempts to bind it to 4 different
1896 <chassis name = "server" implement = "MUST" />
1898 <response name = "bind-ok" />
1900 <!-- Deprecated: "ticket", must be zero -->
1901 <field name = "reserved-1" type = "short" reserved = "1" />
1903 <field name = "queue" domain = "queue-name">
1904 <doc>Specifies the name of the queue to bind.</doc>
1905 <rule name = "queue-known" on-failure = "not-found">
1907 The client MUST either specify a queue name or have previously declared a
1908 queue on the same channel
1910 <doc type = "scenario">
1911 The client opens a channel and attempts to bind an unnamed queue.
1914 <rule name = "must-exist" on-failure = "not-found">
1916 The client MUST NOT attempt to bind a queue that does not exist.
1918 <doc type = "scenario">
1919 The client attempts to bind a non-existent queue.
1924 <field name = "exchange" domain = "exchange-name" label = "name of the exchange to bind to">
1925 <rule name = "exchange-existence" on-failure = "not-found">
1927 A client MUST NOT be allowed to bind a queue to a non-existent exchange.
1929 <doc type = "scenario">
1930 A client attempts to bind an named queue to a undeclared exchange.
1933 <rule name = "default-exchange">
1935 The server MUST accept a blank exchange name to mean the default exchange.
1937 <doc type = "scenario">
1938 The client declares a queue and binds it to a blank exchange name.
1943 <field name = "routing-key" domain = "shortstr" label = "message routing key">
1945 Specifies the routing key for the binding. The routing key is used for routing
1946 messages depending on the exchange configuration. Not all exchanges use a
1947 routing key - refer to the specific exchange documentation. If the queue name
1948 is empty, the server uses the last queue declared on the channel. If the
1949 routing key is also empty, the server uses this queue name for the routing
1950 key as well. If the queue name is provided but the routing key is empty, the
1951 server does the binding with that empty routing key. The meaning of empty
1952 routing keys depends on the exchange implementation.
1954 <rule name = "direct-exchange-key-matching">
1956 If a message queue binds to a direct exchange using routing key K and a
1957 publisher sends the exchange a message with routing key R, then the message
1958 MUST be passed to the message queue if K = R.
1963 <field name = "no-wait" domain = "no-wait" />
1965 <field name = "arguments" domain = "table" label = "arguments for binding">
1967 A set of arguments for the binding. The syntax and semantics of these arguments
1968 depends on the exchange class.
1973 <method name = "bind-ok" synchronous = "1" index = "21" label = "confirm bind successful">
1974 <doc>This method confirms that the bind was successful.</doc>
1976 <chassis name = "client" implement = "MUST" />
1979 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1981 <method name = "unbind" synchronous = "1" index = "50" label = "unbind a queue from an exchange">
1982 <doc>This method unbinds a queue from an exchange.</doc>
1984 <doc>If a unbind fails, the server MUST raise a connection exception.</doc>
1986 <chassis name="server" implement="MUST"/>
1987 <response name="unbind-ok"/>
1989 <!-- Deprecated: "ticket", must be zero -->
1990 <field name = "reserved-1" type = "short" reserved = "1" />
1992 <field name = "queue" domain = "queue-name">
1993 <doc>Specifies the name of the queue to unbind.</doc>
1994 <rule name = "queue-known" on-failure = "not-found">
1996 The client MUST either specify a queue name or have previously declared a
1997 queue on the same channel
1999 <doc type = "scenario">
2000 The client opens a channel and attempts to unbind an unnamed queue.
2003 <rule name = "must-exist" on-failure = "not-found">
2005 The client MUST NOT attempt to unbind a queue that does not exist.
2007 <doc type = "scenario">
2008 The client attempts to unbind a non-existent queue.
2013 <field name = "exchange" domain = "exchange-name">
2014 <doc>The name of the exchange to unbind from.</doc>
2015 <rule name = "must-exist" on-failure = "not-found">
2017 The client MUST NOT attempt to unbind a queue from an exchange that
2020 <doc type = "scenario">
2021 The client attempts to unbind a queue from a non-existent exchange.
2024 <rule name = "default-exchange">
2026 The server MUST accept a blank exchange name to mean the default exchange.
2028 <doc type = "scenario">
2029 The client declares a queue and binds it to a blank exchange name.
2034 <field name = "routing-key" domain = "shortstr" label = "routing key of binding">
2035 <doc>Specifies the routing key of the binding to unbind.</doc>
2038 <field name = "arguments" domain = "table" label = "arguments of binding">
2039 <doc>Specifies the arguments of the binding to unbind.</doc>
2043 <method name = "unbind-ok" synchronous = "1" index = "51" label = "confirm unbind successful">
2044 <doc>This method confirms that the unbind was successful.</doc>
2045 <chassis name = "client" implement = "MUST"/>
2048 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2050 <method name = "purge" synchronous = "1" index = "30" label = "purge a queue">
2052 This method removes all messages from a queue which are not awaiting
2058 The server MUST NOT purge messages that have already been sent to a client
2059 but not yet acknowledged.
2065 The server MAY implement a purge queue or log that allows system administrators
2066 to recover accidentally-purged messages. The server SHOULD NOT keep purged
2067 messages in the same storage spaces as the live messages since the volumes of
2068 purged messages may get very large.
2072 <chassis name = "server" implement = "MUST" />
2074 <response name = "purge-ok" />
2076 <!-- Deprecated: "ticket", must be zero -->
2077 <field name = "reserved-1" type = "short" reserved = "1" />
2079 <field name = "queue" domain = "queue-name">
2080 <doc>Specifies the name of the queue to purge.</doc>
2081 <rule name = "queue-known" on-failure = "not-found">
2083 The client MUST either specify a queue name or have previously declared a
2084 queue on the same channel
2086 <doc type = "scenario">
2087 The client opens a channel and attempts to purge an unnamed queue.
2090 <rule name = "must-exist" on-failure = "not-found">
2092 The client MUST NOT attempt to purge a queue that does not exist.
2094 <doc type = "scenario">
2095 The client attempts to purge a non-existent queue.
2100 <field name = "no-wait" domain = "no-wait" />
2103 <method name = "purge-ok" synchronous = "1" index = "31" label = "confirms a queue purge">
2104 <doc>This method confirms the purge of a queue.</doc>
2106 <chassis name = "client" implement = "MUST" />
2108 <field name = "message-count" domain = "message-count">
2110 Reports the number of messages purged.
2115 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2117 <method name = "delete" synchronous = "1" index = "40" label = "delete a queue">
2119 This method deletes a queue. When a queue is deleted any pending messages are sent
2120 to a dead-letter queue if this is defined in the server configuration, and all
2121 consumers on the queue are cancelled.
2126 The server SHOULD use a dead-letter queue to hold messages that were pending on
2127 a deleted queue, and MAY provide facilities for a system administrator to move
2128 these messages back to an active queue.
2132 <chassis name = "server" implement = "MUST" />
2134 <response name = "delete-ok" />
2136 <!-- Deprecated: "ticket", must be zero -->
2137 <field name = "reserved-1" type = "short" reserved = "1" />
2139 <field name = "queue" domain = "queue-name">
2140 <doc>Specifies the name of the queue to delete.</doc>
2141 <rule name = "queue-known" on-failure = "not-found">
2143 The client MUST either specify a queue name or have previously declared a
2144 queue on the same channel
2146 <doc type = "scenario">
2147 The client opens a channel and attempts to delete an unnamed queue.
2150 <rule name = "must-exist" on-failure = "not-found">
2152 The client MUST NOT attempt to delete a queue that does not exist.
2154 <doc type = "scenario">
2155 The client attempts to delete a non-existent queue.
2160 <field name = "if-unused" domain = "bit" label = "delete only if unused">
2162 If set, the server will only delete the queue if it has no consumers. If the
2163 queue has consumers the server does does not delete it but raises a channel
2166 <rule name = "in-use" on-failure = "precondition-failed">
2168 The server MUST NOT delete a queue that has consumers on it, if the if-unused
2171 <doc type = "scenario">
2172 The client declares a queue, and consumes from it, then tries to delete it
2173 setting if-unused to true.
2178 <field name = "if-empty" domain = "bit" label = "delete only if empty">
2180 If set, the server will only delete the queue if it has no messages.
2182 <rule name = "not-empty" on-failure = "precondition-failed">
2184 The server MUST NOT delete a queue that has messages on it, if the
2185 if-empty field is true.
2187 <doc type = "scenario">
2188 The client declares a queue, binds it and publishes some messages into it,
2189 then tries to delete it setting if-empty to true.
2194 <field name = "no-wait" domain = "no-wait" />
2197 <method name = "delete-ok" synchronous = "1" index = "41" label = "confirm deletion of a queue">
2198 <doc>This method confirms the deletion of a queue.</doc>
2200 <chassis name = "client" implement = "MUST" />
2202 <field name = "message-count" domain = "message-count">
2203 <doc>Reports the number of messages deleted.</doc>
2208 <!-- == BASIC ============================================================ -->
2210 <class name = "basic" handler = "channel" index = "60" label = "work with basic content">
2212 The Basic class provides methods that support an industry-standard messaging model.
2215 <doc type = "grammar">
2216 basic = C:QOS S:QOS-OK
2217 / C:CONSUME S:CONSUME-OK
2218 / C:CANCEL S:CANCEL-OK
2222 / C:GET ( S:GET-OK content / S:GET-EMPTY )
2229 / C:RECOVER S:RECOVER-OK
2232 <chassis name = "server" implement = "MUST" />
2233 <chassis name = "client" implement = "MAY" />
2237 The server SHOULD respect the persistent property of basic messages and
2238 SHOULD make a best-effort to hold persistent basic messages on a reliable
2241 <doc type = "scenario">
2242 Send a persistent message to queue, stop server, restart server and then
2243 verify whether message is still present. Assumes that queues are durable.
2244 Persistence without durable queues makes no sense.
2250 The server MUST NOT discard a persistent basic message in case of a queue
2253 <doc type = "scenario">
2254 Declare a queue overflow situation with persistent messages and verify that
2255 messages do not get lost (presumably the server will write them to disk).
2261 The server MAY use the Channel.Flow method to slow or stop a basic message
2262 publisher when necessary.
2264 <doc type = "scenario">
2265 Declare a queue overflow situation with non-persistent messages and verify
2266 whether the server responds with Channel.Flow or not. Repeat with persistent
2273 The server MAY overflow non-persistent basic messages to persistent
2276 <!-- Test scenario: untestable -->
2281 The server MAY discard or dead-letter non-persistent basic messages on a
2282 priority basis if the queue size exceeds some configured limit.
2284 <!-- Test scenario: untestable -->
2289 The server MUST implement at least 2 priority levels for basic messages,
2290 where priorities 0-4 and 5-9 are treated as two distinct levels.
2292 <doc type = "scenario">
2293 Send a number of priority 0 messages to a queue. Send one priority 9
2294 message. Consume messages from the queue and verify that the first message
2295 received was priority 9.
2301 The server MAY implement up to 10 priority levels.
2303 <doc type = "scenario">
2304 Send a number of messages with mixed priorities to a queue, so that all
2305 priority values from 0 to 9 are exercised. A good scenario would be ten
2306 messages in low-to-high priority. Consume from queue and verify how many
2307 priority levels emerge.
2313 The server MUST deliver messages of the same priority in order irrespective of
2314 their individual persistence.
2316 <doc type = "scenario">
2317 Send a set of messages with the same priority but different persistence
2318 settings to a queue. Consume and verify that messages arrive in same order
2319 as originally published.
2325 The server MUST support un-acknowledged delivery of Basic content, i.e.
2326 consumers with the no-ack field set to TRUE.
2332 The server MUST support explicitly acknowledged delivery of Basic content,
2333 i.e. consumers with the no-ack field set to FALSE.
2335 <doc type = "scenario">
2336 Declare a queue and a consumer using explicit acknowledgements. Publish a
2337 set of messages to the queue. Consume the messages but acknowledge only
2338 half of them. Disconnect and reconnect, and consume from the queue.
2339 Verify that the remaining messages are received.
2343 <!-- These are the properties for a Basic content -->
2345 <!-- MIME typing -->
2346 <field name = "content-type" domain = "shortstr" label = "MIME content type" />
2347 <!-- MIME typing -->
2348 <field name = "content-encoding" domain = "shortstr" label = "MIME content encoding" />
2349 <!-- For applications, and for header exchange routing -->
2350 <field name = "headers" domain = "table" label = "message header field table" />
2351 <!-- For queues that implement persistence -->
2352 <field name = "delivery-mode" domain = "octet" label = "non-persistent (1) or persistent (2)" />
2353 <!-- For queues that implement priorities -->
2354 <field name = "priority" domain = "octet" label = "message priority, 0 to 9" />
2355 <!-- For application use, no formal behaviour -->
2356 <field name = "correlation-id" domain = "shortstr" label = "application correlation identifier" />
2357 <!-- For application use, no formal behaviour but may hold the
2358 name of a private response queue, when used in request messages -->
2359 <field name = "reply-to" domain = "shortstr" label = "address to reply to" />
2360 <!-- For implementation use, no formal behaviour -->
2361 <field name = "expiration" domain = "shortstr" label = "message expiration specification" />
2362 <!-- For application use, no formal behaviour -->
2363 <field name = "message-id" domain = "shortstr" label = "application message identifier" />
2364 <!-- For application use, no formal behaviour -->
2365 <field name = "timestamp" domain = "timestamp" label = "message timestamp" />
2366 <!-- For application use, no formal behaviour -->
2367 <field name = "type" domain = "shortstr" label = "message type name" />
2368 <!-- For application use, no formal behaviour -->
2369 <field name = "user-id" domain = "shortstr" label = "creating user id" />
2370 <!-- For application use, no formal behaviour -->
2371 <field name = "app-id" domain = "shortstr" label = "creating application id" />
2372 <!-- Deprecated, was old cluster-id property -->
2373 <field name = "reserved" domain = "shortstr" label = "reserved, must be empty" />
2375 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2377 <method name = "qos" synchronous = "1" index = "10" label = "specify quality of service">
2379 This method requests a specific quality of service. The QoS can be specified for the
2380 current channel or for all channels on the connection. The particular properties and
2381 semantics of a qos method always depend on the content class semantics. Though the
2382 qos method could in principle apply to both peers, it is currently meaningful only
2386 <chassis name = "server" implement = "MUST" />
2387 <response name = "qos-ok" />
2389 <field name = "prefetch-size" domain = "long" label = "prefetch window in octets">
2391 The client can request that messages be sent in advance so that when the client
2392 finishes processing a message, the following message is already held locally,
2393 rather than needing to be sent down the channel. Prefetching gives a performance
2394 improvement. This field specifies the prefetch window size in octets. The server
2395 will send a message in advance if it is equal to or smaller in size than the
2396 available prefetch size (and also falls into other prefetch limits). May be set
2397 to zero, meaning "no specific limit", although other prefetch limits may still
2398 apply. The prefetch-size is ignored if the no-ack option is set.
2402 The server MUST ignore this setting when the client is not processing any
2403 messages - i.e. the prefetch size does not limit the transfer of single
2404 messages to a client, only the sending in advance of more messages while
2405 the client still has one or more unacknowledged messages.
2407 <doc type = "scenario">
2408 Define a QoS prefetch-size limit and send a single message that exceeds
2409 that limit. Verify that the message arrives correctly.
2414 <field name = "prefetch-count" domain = "short" label = "prefetch window in messages">
2416 Specifies a prefetch window in terms of whole messages. This field may be used
2417 in combination with the prefetch-size field; a message will only be sent in
2418 advance if both prefetch windows (and those at the channel and connection level)
2419 allow it. The prefetch-count is ignored if the no-ack option is set.
2423 The server may send less data in advance than allowed by the client's
2424 specified prefetch windows but it MUST NOT send more.
2426 <doc type = "scenario">
2427 Define a QoS prefetch-size limit and a prefetch-count limit greater than
2428 one. Send multiple messages that exceed the prefetch size. Verify that
2429 no more than one message arrives at once.
2434 <field name = "global" domain = "bit" label = "apply to entire connection">
2436 By default the QoS settings apply to the current channel only. If this field is
2437 set, they are applied to the entire connection.
2442 <method name = "qos-ok" synchronous = "1" index = "11" label = "confirm the requested qos">
2444 This method tells the client that the requested QoS levels could be handled by the
2445 server. The requested QoS applies to all active consumers until a new QoS is
2448 <chassis name = "client" implement = "MUST" />
2451 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2453 <method name = "consume" synchronous = "1" index = "20" label = "start a queue consumer">
2455 This method asks the server to start a "consumer", which is a transient request for
2456 messages from a specific queue. Consumers last as long as the channel they were
2457 declared on, or until the client cancels them.
2462 The server SHOULD support at least 16 consumers per queue, and ideally, impose
2463 no limit except as defined by available resources.
2465 <doc type = "scenario">
2466 Declare a queue and create consumers on that queue until the server closes the
2467 connection. Verify that the number of consumers created was at least sixteen
2468 and report the total number.
2472 <chassis name = "server" implement = "MUST" />
2473 <response name = "consume-ok" />
2475 <!-- Deprecated: "ticket", must be zero -->
2476 <field name = "reserved-1" type = "short" reserved = "1" />
2478 <field name = "queue" domain = "queue-name">
2479 <doc>Specifies the name of the queue to consume from.</doc>
2482 <field name = "consumer-tag" domain = "consumer-tag">
2484 Specifies the identifier for the consumer. The consumer tag is local to a
2485 channel, so two clients can use the same consumer tags. If this field is
2486 empty the server will generate a unique tag.
2488 <rule name = "01" on-failure = "not-allowed">
2490 The client MUST NOT specify a tag that refers to an existing consumer.
2492 <doc type = "scenario">
2493 Attempt to create two consumers with the same non-empty tag, on the
2497 <rule name = "02" on-failure = "not-allowed">
2499 The consumer tag is valid only within the channel from which the
2500 consumer was created. I.e. a client MUST NOT create a consumer in one
2501 channel and then use it in another.
2503 <doc type = "scenario">
2504 Attempt to create a consumer in one channel, then use in another channel,
2505 in which consumers have also been created (to test that the server uses
2506 unique consumer tags).
2511 <field name = "no-local" domain = "no-local" />
2513 <field name = "no-ack" domain = "no-ack" />
2515 <field name = "exclusive" domain = "bit" label = "request exclusive access">
2517 Request exclusive consumer access, meaning only this consumer can access the
2521 <rule name = "01" on-failure = "access-refused">
2523 The client MAY NOT gain exclusive access to a queue that already has
2526 <doc type = "scenario">
2527 Open two connections to a server, and in one connection declare a shared
2528 (non-exclusive) queue and then consume from the queue. In the second
2529 connection attempt to consume from the same queue using the exclusive
2535 <field name = "no-wait" domain = "no-wait" />
2537 <field name = "arguments" domain = "table" label = "arguments for declaration">
2539 A set of arguments for the consume. The syntax and semantics of these
2540 arguments depends on the server implementation.
2545 <method name = "consume-ok" synchronous = "1" index = "21" label = "confirm a new consumer">
2547 The server provides the client with a consumer tag, which is used by the client
2548 for methods called on the consumer at a later stage.
2550 <chassis name = "client" implement = "MUST" />
2551 <field name = "consumer-tag" domain = "consumer-tag">
2553 Holds the consumer tag specified by the client or provided by the server.
2558 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2560 <method name = "cancel" synchronous = "1" index = "30" label = "end a queue consumer">
2562 This method cancels a consumer. This does not affect already delivered
2563 messages, but it does mean the server will not send any more messages for
2564 that consumer. The client may receive an arbitrary number of messages in
2565 between sending the cancel method and receiving the cancel-ok reply.
2567 It may also be sent from the server to the client in the event
2568 of the consumer being unexpectedly cancelled (i.e. cancelled
2569 for any reason other than the server receiving the
2570 corresponding basic.cancel from the client). This allows
2571 clients to be notified of the loss of consumers due to events
2572 such as queue deletion. Note that as it is not a MUST for
2573 clients to accept this method from the client, it is advisable
2574 for the broker to be able to identify those clients that are
2575 capable of accepting the method, through some means of
2576 capability negotiation.
2581 If the queue does not exist the server MUST ignore the cancel method, so
2582 long as the consumer tag is valid for that channel.
2584 <doc type = "scenario">
2589 <chassis name = "server" implement = "MUST" />
2590 <chassis name = "client" implement = "SHOULD" />
2591 <response name = "cancel-ok" />
2593 <field name = "consumer-tag" domain = "consumer-tag" />
2594 <field name = "no-wait" domain = "no-wait" />
2597 <method name = "cancel-ok" synchronous = "1" index = "31" label = "confirm a cancelled consumer">
2599 This method confirms that the cancellation was completed.
2601 <chassis name = "client" implement = "MUST" />
2602 <chassis name = "server" implement = "MAY" />
2603 <field name = "consumer-tag" domain = "consumer-tag" />
2606 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2608 <method name = "publish" content = "1" index = "40" label = "publish a message">
2610 This method publishes a message to a specific exchange. The message will be routed
2611 to queues as defined by the exchange configuration and distributed to any active
2612 consumers when the transaction, if any, is committed.
2615 <chassis name = "server" implement = "MUST" />
2617 <!-- Deprecated: "ticket", must be zero -->
2618 <field name = "reserved-1" type = "short" reserved = "1" />
2620 <field name = "exchange" domain = "exchange-name">
2622 Specifies the name of the exchange to publish to. The exchange name can be
2623 empty, meaning the default exchange. If the exchange name is specified, and that
2624 exchange does not exist, the server will raise a channel exception.
2627 <rule name = "must-exist" on-failure = "not-found">
2629 The client MUST NOT attempt to publish a content to an exchange that
2632 <doc type = "scenario">
2633 The client attempts to publish a content to a non-existent exchange.
2636 <rule name = "default-exchange">
2638 The server MUST accept a blank exchange name to mean the default exchange.
2640 <doc type = "scenario">
2641 The client declares a queue and binds it to a blank exchange name.
2646 If the exchange was declared as an internal exchange, the server MUST raise
2647 a channel exception with a reply code 403 (access refused).
2649 <doc type = "scenario">
2656 The exchange MAY refuse basic content in which case it MUST raise a channel
2657 exception with reply code 540 (not implemented).
2659 <doc type = "scenario">
2665 <field name = "routing-key" domain = "shortstr" label = "Message routing key">
2667 Specifies the routing key for the message. The routing key is used for routing
2668 messages depending on the exchange configuration.
2672 <field name = "mandatory" domain = "bit" label = "indicate mandatory routing">
2674 This flag tells the server how to react if the message cannot be routed to a
2675 queue. If this flag is set, the server will return an unroutable message with a
2676 Return method. If this flag is zero, the server silently drops the message.
2681 The server SHOULD implement the mandatory flag.
2683 <doc type = "scenario">
2689 <field name = "immediate" domain = "bit" label = "request immediate delivery">
2691 This flag tells the server how to react if the message cannot be routed to a
2692 queue consumer immediately. If this flag is set, the server will return an
2693 undeliverable message with a Return method. If this flag is zero, the server
2694 will queue the message, but with no guarantee that it will ever be consumed.
2699 The server SHOULD implement the immediate flag.
2701 <doc type = "scenario">
2708 <method name = "return" content = "1" index = "50" label = "return a failed message">
2710 This method returns an undeliverable message that was published with the "immediate"
2711 flag set, or an unroutable message published with the "mandatory" flag set. The
2712 reply code and text provide information about the reason that the message was
2716 <chassis name = "client" implement = "MUST" />
2718 <field name = "reply-code" domain = "reply-code" />
2719 <field name = "reply-text" domain = "reply-text" />
2721 <field name = "exchange" domain = "exchange-name">
2723 Specifies the name of the exchange that the message was originally published
2724 to. May be empty, meaning the default exchange.
2728 <field name = "routing-key" domain = "shortstr" label = "Message routing key">
2730 Specifies the routing key name specified when the message was published.
2735 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2737 <method name = "deliver" content = "1" index = "60"
2738 label = "notify the client of a consumer message">
2740 This method delivers a message to the client, via a consumer. In the asynchronous
2741 message delivery model, the client starts a consumer using the Consume method, then
2742 the server responds with Deliver methods as and when messages arrive for that
2748 The server SHOULD track the number of times a message has been delivered to
2749 clients and when a message is redelivered a certain number of times - e.g. 5
2750 times - without being acknowledged, the server SHOULD consider the message to be
2751 unprocessable (possibly causing client applications to abort), and move the
2752 message to a dead letter queue.
2754 <doc type = "scenario">
2759 <chassis name = "client" implement = "MUST" />
2761 <field name = "consumer-tag" domain = "consumer-tag" />
2762 <field name = "delivery-tag" domain = "delivery-tag" />
2763 <field name = "redelivered" domain = "redelivered" />
2765 <field name = "exchange" domain = "exchange-name">
2767 Specifies the name of the exchange that the message was originally published to.
2768 May be empty, indicating the default exchange.
2772 <field name = "routing-key" domain = "shortstr" label = "Message routing key">
2773 <doc>Specifies the routing key name specified when the message was published.</doc>
2777 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2779 <method name = "get" synchronous = "1" index = "70" label = "direct access to a queue">
2781 This method provides a direct access to the messages in a queue using a synchronous
2782 dialogue that is designed for specific types of application where synchronous
2783 functionality is more important than performance.
2786 <response name = "get-ok" />
2787 <response name = "get-empty" />
2788 <chassis name = "server" implement = "MUST" />
2790 <!-- Deprecated: "ticket", must be zero -->
2791 <field name = "reserved-1" type = "short" reserved = "1" />
2793 <field name = "queue" domain = "queue-name">
2794 <doc>Specifies the name of the queue to get a message from.</doc>
2796 <field name = "no-ack" domain = "no-ack" />
2799 <method name = "get-ok" synchronous = "1" content = "1" index = "71"
2800 label = "provide client with a message">
2802 This method delivers a message to the client following a get method. A message
2803 delivered by 'get-ok' must be acknowledged unless the no-ack option was set in the
2807 <chassis name = "client" implement = "MAY" />
2809 <field name = "delivery-tag" domain = "delivery-tag" />
2810 <field name = "redelivered" domain = "redelivered" />
2811 <field name = "exchange" domain = "exchange-name">
2813 Specifies the name of the exchange that the message was originally published to.
2814 If empty, the message was published to the default exchange.
2818 <field name = "routing-key" domain = "shortstr" label = "Message routing key">
2819 <doc>Specifies the routing key name specified when the message was published.</doc>
2822 <field name = "message-count" domain = "message-count" />
2825 <method name = "get-empty" synchronous = "1" index = "72"
2826 label = "indicate no messages available">
2828 This method tells the client that the queue has no messages available for the
2831 <chassis name = "client" implement = "MAY" />
2832 <!-- Deprecated: "cluster-id", must be empty -->
2833 <field name = "reserved-1" type = "shortstr" reserved = "1" />
2836 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2838 <method name = "ack" index = "80" label = "acknowledge one or more messages">
2840 When sent by the client, this method acknowledges one or more
2841 messages delivered via the Deliver or Get-Ok methods.
2843 When sent by server, this method acknowledges one or more
2844 messages published with the Publish method on a channel in
2847 The acknowledgement can be for a single message or a set of
2848 messages up to and including a specific message.
2851 <chassis name = "server" implement = "MUST" />
2852 <chassis name ="client" implement = "MUST"/>
2854 <field name = "delivery-tag" domain = "delivery-tag" />
2855 <field name = "multiple" domain = "bit" label = "acknowledge multiple messages">
2857 If set to 1, the delivery tag is treated as "up to and
2858 including", so that multiple messages can be acknowledged
2859 with a single method. If set to zero, the delivery tag
2860 refers to a single message. If the multiple field is 1, and
2861 the delivery tag is zero, this indicates acknowledgement of
2862 all outstanding messages.
2864 <rule name = "exists" on-failure = "precondition-failed">
2866 A message MUST not be acknowledged more than once. The
2867 receiving peer MUST validate that a non-zero delivery-tag
2868 refers to a delivered message, and raise a channel
2869 exception if this is not the case. On a transacted
2870 channel, this check MUST be done immediately and not
2871 delayed until a Tx.Commit.
2873 <doc type = "scenario">
2880 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2882 <method name = "reject" index = "90" label = "reject an incoming message">
2884 This method allows a client to reject a message. It can be used to interrupt and
2885 cancel large incoming messages, or return untreatable messages to their original
2891 The server SHOULD be capable of accepting and process the Reject method while
2892 sending message content with a Deliver or Get-Ok method. I.e. the server should
2893 read and process incoming methods while sending output frames. To cancel a
2894 partially-send content, the server sends a content body frame of size 1 (i.e.
2895 with no data except the frame-end octet).
2901 The server SHOULD interpret this method as meaning that the client is unable to
2902 process the message at this time.
2904 <doc type = "scenario">
2911 The client MUST NOT use this method as a means of selecting messages to process.
2913 <doc type = "scenario">
2918 <chassis name = "server" implement = "MUST" />
2920 <field name = "delivery-tag" domain = "delivery-tag" />
2922 <field name = "requeue" domain = "bit" label = "requeue the message">
2924 If requeue is true, the server will attempt to requeue the message. If requeue
2925 is false or the requeue attempt fails the messages are discarded or dead-lettered.
2930 The server MUST NOT deliver the message to the same client within the
2931 context of the current channel. The recommended strategy is to attempt to
2932 deliver the message to an alternative consumer, and if that is not possible,
2933 to move the message to a dead-letter queue. The server MAY use more
2934 sophisticated tracking to hold the message on the queue and redeliver it to
2935 the same client at a later stage.
2937 <doc type = "scenario">
2944 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2946 <method name = "recover-async" index = "100" label = "redeliver unacknowledged messages"
2949 This method asks the server to redeliver all unacknowledged messages on a
2950 specified channel. Zero or more messages may be redelivered. This method
2951 is deprecated in favour of the synchronous Recover/Recover-Ok.
2955 The server MUST set the redelivered flag on all messages that are resent.
2957 <doc type = "scenario">
2961 <chassis name = "server" implement = "MAY" />
2962 <field name = "requeue" domain = "bit" label = "requeue the message">
2964 If this field is zero, the message will be redelivered to the original
2965 recipient. If this bit is 1, the server will attempt to requeue the message,
2966 potentially then delivering it to an alternative subscriber.
2971 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2973 <method name = "recover" index = "110" label = "redeliver unacknowledged messages">
2975 This method asks the server to redeliver all unacknowledged messages on a
2976 specified channel. Zero or more messages may be redelivered. This method
2977 replaces the asynchronous Recover.
2981 The server MUST set the redelivered flag on all messages that are resent.
2983 <doc type = "scenario">
2987 <chassis name = "server" implement = "MUST" />
2988 <field name = "requeue" domain = "bit" label = "requeue the message">
2990 If this field is zero, the message will be redelivered to the original
2991 recipient. If this bit is 1, the server will attempt to requeue the message,
2992 potentially then delivering it to an alternative subscriber.
2997 <method name = "recover-ok" synchronous = "1" index = "111" label = "confirm recovery">
2999 This method acknowledges a Basic.Recover method.
3001 <chassis name = "client" implement = "MUST" />
3004 <method name = "nack" index = "120" label = "reject one or more incoming messages">
3006 This method allows a client to reject one or more incoming messages. It can be
3007 used to interrupt and cancel large incoming messages, or return untreatable
3008 messages to their original queue.
3010 This method is also used by the server to inform publishers on channels in
3011 confirm mode of unhandled messages. If a publisher receives this method, it
3012 probably needs to republish the offending messages.
3017 The server SHOULD be capable of accepting and processing the Nack method while
3018 sending message content with a Deliver or Get-Ok method. I.e. the server should
3019 read and process incoming methods while sending output frames. To cancel a
3020 partially-send content, the server sends a content body frame of size 1 (i.e.
3021 with no data except the frame-end octet).
3027 The server SHOULD interpret this method as meaning that the client is unable to
3028 process the message at this time.
3030 <doc type = "scenario">
3037 The client MUST NOT use this method as a means of selecting messages to process.
3039 <doc type = "scenario">
3046 A client publishing messages to a channel in confirm mode SHOULD be capable of accepting
3047 and somehow handling the Nack method.
3049 <doc type = "scenario">
3054 <chassis name = "server" implement = "MUST" />
3055 <chassis name = "client" implement = "MUST" />
3057 <field name = "delivery-tag" domain = "delivery-tag" />
3059 <field name = "multiple" domain = "bit" label = "reject multiple messages">
3061 If set to 1, the delivery tag is treated as "up to and
3062 including", so that multiple messages can be rejected
3063 with a single method. If set to zero, the delivery tag
3064 refers to a single message. If the multiple field is 1, and
3065 the delivery tag is zero, this indicates rejection of
3066 all outstanding messages.
3068 <rule name = "exists" on-failure = "precondition-failed">
3070 A message MUST not be rejected more than once. The
3071 receiving peer MUST validate that a non-zero delivery-tag
3072 refers to an unacknowledged, delivered message, and
3073 raise a channel exception if this is not the case.
3075 <doc type = "scenario">
3081 <field name = "requeue" domain = "bit" label = "requeue the message">
3083 If requeue is true, the server will attempt to requeue the message. If requeue
3084 is false or the requeue attempt fails the messages are discarded or dead-lettered.
3085 Clients receiving the Nack methods should ignore this flag.
3090 The server MUST NOT deliver the message to the same client within the
3091 context of the current channel. The recommended strategy is to attempt to
3092 deliver the message to an alternative consumer, and if that is not possible,
3093 to move the message to a dead-letter queue. The server MAY use more
3094 sophisticated tracking to hold the message on the queue and redeliver it to
3095 the same client at a later stage.
3097 <doc type = "scenario">
3106 <!-- == TX =============================================================== -->
3108 <class name = "tx" handler = "channel" index = "90" label = "work with transactions">
3110 The Tx class allows publish and ack operations to be batched into atomic
3111 units of work. The intention is that all publish and ack requests issued
3112 within a transaction will complete successfully or none of them will.
3113 Servers SHOULD implement atomic transactions at least where all publish
3114 or ack requests affect a single queue. Transactions that cover multiple
3115 queues may be non-atomic, given that queues can be created and destroyed
3116 asynchronously, and such events do not form part of any transaction.
3117 Further, the behaviour of transactions with respect to the immediate and
3118 mandatory flags on Basic.Publish methods is not defined.
3121 <rule name = "not multiple queues">
3123 Applications MUST NOT rely on the atomicity of transactions that
3124 affect more than one queue.
3127 <rule name = "not immediate">
3129 Applications MUST NOT rely on the behaviour of transactions that
3130 include messages published with the immediate option.
3133 <rule name = "not mandatory">
3135 Applications MUST NOT rely on the behaviour of transactions that
3136 include messages published with the mandatory option.
3140 <doc type = "grammar">
3141 tx = C:SELECT S:SELECT-OK
3142 / C:COMMIT S:COMMIT-OK
3143 / C:ROLLBACK S:ROLLBACK-OK
3146 <chassis name = "server" implement = "SHOULD" />
3147 <chassis name = "client" implement = "MAY" />
3149 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3151 <method name = "select" synchronous = "1" index = "10" label = "select standard transaction mode">
3153 This method sets the channel to use standard transactions. The client must use this
3154 method at least once on a channel before using the Commit or Rollback methods.
3156 <chassis name = "server" implement = "MUST" />
3157 <response name = "select-ok" />
3160 <method name = "select-ok" synchronous = "1" index = "11" label = "confirm transaction mode">
3162 This method confirms to the client that the channel was successfully set to use
3163 standard transactions.
3165 <chassis name = "client" implement = "MUST" />
3168 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3170 <method name = "commit" synchronous = "1" index = "20" label = "commit the current transaction">
3172 This method commits all message publications and acknowledgments performed in
3173 the current transaction. A new transaction starts immediately after a commit.
3175 <chassis name = "server" implement = "MUST" />
3176 <response name = "commit-ok" />
3178 <rule name = "transacted" on-failure = "precondition-failed">
3180 The client MUST NOT use the Commit method on non-transacted channels.
3182 <doc type = "scenario">
3183 The client opens a channel and then uses Tx.Commit.
3188 <method name = "commit-ok" synchronous = "1" index = "21" label = "confirm a successful commit">
3190 This method confirms to the client that the commit succeeded. Note that if a commit
3191 fails, the server raises a channel exception.
3193 <chassis name = "client" implement = "MUST" />
3196 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3198 <method name = "rollback" synchronous = "1" index = "30"
3199 label = "abandon the current transaction">
3201 This method abandons all message publications and acknowledgments performed in
3202 the current transaction. A new transaction starts immediately after a rollback.
3203 Note that unacked messages will not be automatically redelivered by rollback;
3204 if that is required an explicit recover call should be issued.
3206 <chassis name = "server" implement = "MUST" />
3207 <response name = "rollback-ok" />
3209 <rule name = "transacted" on-failure = "precondition-failed">
3211 The client MUST NOT use the Rollback method on non-transacted channels.
3213 <doc type = "scenario">
3214 The client opens a channel and then uses Tx.Rollback.
3219 <method name = "rollback-ok" synchronous = "1" index = "31" label = "confirm successful rollback">
3221 This method confirms to the client that the rollback succeeded. Note that if an
3222 rollback fails, the server raises a channel exception.
3224 <chassis name = "client" implement = "MUST" />
3228 <!-- == CONFIRM ========================================================== -->
3230 <class name = "confirm" handler = "channel" index = "85" label = "work with confirms">
3232 The Confirm class allows publishers to put the channel in
3233 confirm mode and susequently be notified when messages have been
3234 handled by the broker. The intention is that all messages
3235 published on a channel in confirm mode will be acknowledged at
3236 some point. By acknowledging a message the broker assumes
3237 responsibility for it and indicates that it has done something
3238 it deems reasonable with it.
3240 Unroutable mandatory or immediate messages are acknowledged
3241 right after the Basic.Return method. Messages are acknowledged
3242 when all queues to which the message has been routed
3243 have either delivered the message and received an
3244 acknowledgement (if required), or enqueued the message (and
3245 persisted it if required).
3247 Published messages are assigned ascending sequence numbers,
3248 starting at 1 with the first Confirm.Select method. The server
3249 confirms messages by sending Basic.Ack methods referring to these
3253 <rule name = "all messages acknowledged">
3255 The server MUST acknowledge all messages received after the
3256 channel was put into confirm mode.
3260 <rule name = "all queues">
3262 The server MUST acknowledge a message only after it was
3263 properly handled by all the queues it was delivered to.
3267 <rule name = "unroutable messages">
3269 The server MUST acknowledge an unroutable mandatory or
3270 immediate message only after it sends the Basic.Return.
3274 <rule name = "time guarantees">
3276 No guarantees are made as to how soon a message is
3277 acknowledged. Applications SHOULD NOT make assumptions about
3282 <doc type = "grammar">
3283 confirm = C:SELECT S:SELECT-OK
3286 <chassis name = "server" implement = "SHOULD" />
3287 <chassis name = "client" implement = "MAY" />
3289 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3291 <method name="select" synchronous="1" index="10">
3292 select confirm mode (i.e. enable publisher acknowledgements)
3294 This method sets the channel to use publisher acknowledgements.
3295 The client can only use this method on a non-transactional
3298 <chassis name="server" implement="MUST"/>
3299 <response name="select-ok"/>
3300 <field name = "nowait" type = "bit">
3301 do not send a reply method
3303 If set, the server will not respond to the method. The client should
3304 not wait for a reply method. If the server could not complete the
3305 method it will raise a channel or connection exception.
3310 <method name="select-ok" synchronous="1" index="11">
3311 acknowledge confirm mode
3313 This method confirms to the client that the channel was successfully
3314 set to use publisher acknowledgements.
3316 <chassis name="client" implement="MUST"/>