2009-05-21 Michael Barker <mike@middlesoft.co.uk>
[mono.git] / mcs / class / RabbitMQ.Client / docs / specs / amqp0-8.xml
1 <?xml version="1.0"?>
2 <!-- WARNING: Modified from the official 0-8 specification XML by
3      the addition of queue.unbind, queue.unbind-ok -->
4 <!--
5 Copyright Notice
6 ================
7 © Copyright JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc.,
8 iMatix Corporation, IONA� Technologies, Red Hat, Inc.,
9 TWIST Process Innovations, and 29West Inc. 2006. All rights reserved.
10
11 License
12 =======
13 JPMorgan Chase Bank & Co., Cisco Systems, Inc., Envoy Technologies Inc., iMatix 
14 Corporation, IONA� Technologies, Red Hat, Inc., TWIST Process Innovations, and 
15 29West Inc. (collectively, the "Authors") each hereby grants to you a worldwide,
16 perpetual, royalty-free, nontransferable, nonexclusive license to
17 (i) copy, display, and implement the Advanced Messaging Queue Protocol
18 ("AMQP") Specification and (ii) the Licensed Claims that are held by
19 the Authors, all for the purpose of implementing the Advanced Messaging
20 Queue Protocol Specification. Your license and any rights under this
21 Agreement will terminate immediately without notice from
22 any Author if you bring any claim, suit, demand, or action related to
23 the Advanced Messaging Queue Protocol Specification against any Author.
24 Upon termination, you shall destroy all copies of the Advanced Messaging
25 Queue Protocol Specification in your possession or control.
26
27 As used hereunder, "Licensed Claims" means those claims of a patent or
28 patent application, throughout the world, excluding design patents and
29 design registrations, owned or controlled, or that can be sublicensed
30 without fee and in compliance with the requirements of this
31 Agreement, by an Author or its affiliates now or at any
32 future time and which would necessarily be infringed by implementation
33 of the Advanced Messaging Queue Protocol Specification. A claim is
34 necessarily infringed hereunder only when it is not possible to avoid
35 infringing it because there is no plausible non-infringing alternative
36 for implementing the required portions of the Advanced Messaging Queue
37 Protocol Specification. Notwithstanding the foregoing, Licensed Claims
38 shall not include any claims other than as set forth above even if
39 contained in the same patent as Licensed Claims; or that read solely
40 on any implementations of any portion of the Advanced Messaging Queue
41 Protocol Specification that are not required by the Advanced Messaging
42 Queue Protocol Specification, or that, if licensed, would require a
43 payment of royalties by the licensor to unaffiliated third parties.
44 Moreover, Licensed Claims shall not include (i) any enabling technologies
45 that may be necessary to make or use any Licensed Product but are not
46 themselves expressly set forth in the Advanced Messaging Queue Protocol
47 Specification (e.g., semiconductor manufacturing technology, compiler
48 technology, object oriented technology, networking technology, operating
49 system technology, and the like); or (ii) the implementation of other
50 published standards developed elsewhere and merely referred to in the
51 body of the Advanced Messaging Queue Protocol Specification, or
52 (iii) any Licensed Product and any combinations thereof the purpose or
53 function of which is not required for compliance with the Advanced
54 Messaging Queue Protocol Specification. For purposes of this definition,
55 the Advanced Messaging Queue Protocol Specification shall be deemed to
56 include both architectural and interconnection requirements essential
57 for interoperability and may also include supporting source code artifacts
58 where such architectural, interconnection requirements and source code
59 artifacts are expressly identified as being required or documentation to
60 achieve compliance with the Advanced Messaging Queue Protocol Specification.
61
62 As used hereunder, "Licensed Products" means only those specific portions
63 of products (hardware, software or combinations thereof) that implement
64 and are compliant with all relevant portions of the Advanced Messaging
65 Queue Protocol Specification.
66
67 The following disclaimers, which you hereby also acknowledge as to any
68 use you may make of the Advanced Messaging Queue Protocol Specification:
69
70 THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION IS PROVIDED "AS IS,"
71 AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
72 IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY,
73 FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE
74 CONTENTS OF THE ADVANCED MESSAGING QUEUE PROTOCOL SPECIFICATION ARE
75 SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF THE ADVANCED
76 MESSAGING QUEUE PROTOCOL SPECIFICATION WILL NOT INFRINGE ANY THIRD PARTY 
77 PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
78
79 THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
80 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
81 USE, IMPLEMENTATION OR DISTRIBUTION OF THE ADVANCED MESSAGING QUEUE
82 PROTOCOL SPECIFICATION.
83
84 The name and trademarks of the Authors may NOT be used in any manner,
85 including advertising or publicity pertaining to the Advanced Messaging
86 Queue Protocol Specification or its contents without specific, written
87 prior permission. Title to copyright in the Advanced Messaging Queue
88 Protocol Specification will at all times remain with the Authors.
89
90 No other rights are granted by implication, estoppel or otherwise.
91
92 Upon termination of your license or rights under this Agreement, you
93 shall destroy all copies of the Advanced Messaging Queue Protocol
94 Specification in your possession or control.
95
96 Trademarks
97 ==========
98 "JPMorgan", "JPMorgan Chase", "Chase", the JPMorgan Chase logo and the
99 Octagon Symbol are trademarks of JPMorgan Chase & Co.
100
101 IMATIX and the iMatix logo are trademarks of iMatix Corporation sprl.
102
103 IONA, IONA Technologies, and the IONA logos are trademarks of IONA
104 Technologies PLC and/or its subsidiaries.
105
106 LINUX is a trademark of Linus Torvalds. RED HAT and JBOSS are registered
107 trademarks of Red Hat, Inc. in the US and other countries.
108
109 Java, all Java-based trademarks and OpenOffice.org are trademarks of
110 Sun Microsystems, Inc. in the United States, other countries, or both.
111
112 Other company, product, or service names may be trademarks or service
113 marks of others.
114
115 Links to full AMQP specification:
116 =================================
117 http://www.envoytech.org/spec/amq/
118 http://www.iona.com/opensource/amqp/
119 http://www.redhat.com/solutions/specifications/amqp/
120 http://www.twiststandards.org/tiki-index.php?page=AMQ
121 http://www.imatix.com/amqp
122
123 -->
124
125 <amqp major="8" minor="0" port="5672" comment="AMQ protocol 0.80">
126     AMQ Protocol 0.80
127 <!--
128 ======================================================
129 ==       CONSTANTS
130 ======================================================
131 -->
132   <constant name="frame method" value="1"/>
133   <constant name="frame header" value="2"/>
134   <constant name="frame body" value="3"/>
135   <constant name="frame oob method" value="4"/>
136   <constant name="frame oob header" value="5"/>
137   <constant name="frame oob body" value="6"/>
138   <constant name="frame trace" value="7"/>
139   <constant name="frame heartbeat" value="8"/>
140   <constant name="frame min size" value="4096"/>
141   <constant name="frame end" value="206"/>
142   <constant name="reply success" value="200">
143   Indicates that the method completed successfully. This reply code is
144   reserved for future use - the current protocol design does not use
145   positive confirmation and reply codes are sent only in case of an
146   error.
147 </constant>
148   <constant name="not delivered" value="310" class="soft error">
149   The client asked for a specific message that is no longer available.
150   The message was delivered to another client, or was purged from the
151   queue for some other reason.
152 </constant>
153   <constant name="content too large" value="311" class="soft error">
154   The client attempted to transfer content larger than the server
155   could accept at the present time.  The client may retry at a later
156   time.
157 </constant>
158   <constant name="connection forced" value="320" class="hard error">
159   An operator intervened to close the connection for some reason.
160   The client may retry at some later date.
161 </constant>
162   <constant name="invalid path" value="402" class="hard error">
163   The client tried to work with an unknown virtual host or cluster.
164 </constant>
165   <constant name="access refused" value="403" class="soft error">
166   The client attempted to work with a server entity to which it has
167   no  due to security settings.
168 </constant>
169   <constant name="not found" value="404" class="soft error">
170   The client attempted to work with a server entity that does not exist.
171 </constant>
172   <constant name="resource locked" value="405" class="soft error">
173   The client attempted to work with a server entity to which it has
174   no access because another client is working with it.
175 </constant>
176   <constant name="frame error" value="501" class="hard error">
177   The client sent a malformed frame that the server could not decode.
178   This strongly implies a programming error in the client.
179 </constant>
180   <constant name="syntax error" value="502" class="hard error">
181   The client sent a frame that contained illegal values for one or more
182   fields.  This strongly implies a programming error in the client.
183 </constant>
184   <constant name="command invalid" value="503" class="hard error">
185   The client sent an invalid sequence of frames, attempting to perform
186   an operation that was considered invalid by the server. This usually
187   implies a programming error in the client.
188 </constant>
189   <constant name="channel error" value="504" class="hard error">
190   The client attempted to work with a channel that had not been
191   correctly opened.  This most likely indicates a fault in the client
192   layer.
193 </constant>
194   <constant name="resource error" value="506" class="hard error">
195   The server could not complete the method because it lacked sufficient
196   resources. This may be due to the client creating too many of some
197   type of entity.
198 </constant>
199   <constant name="not allowed" value="530" class="hard error">
200   The client tried to work with some entity in a manner that is
201   prohibited by the server, due to security settings or by some other
202   criteria.
203 </constant>
204   <constant name="not implemented" value="540" class="hard error">
205   The client tried to use functionality that is not implemented in the
206   server.
207 </constant>
208   <constant name="internal error" value="541" class="hard error">
209   The server could not complete the method because of an internal error.
210   The server may require intervention by an operator in order to resume
211   normal operations.
212 </constant>
213   <!--
214 ======================================================
215 ==       DOMAIN TYPES
216 ======================================================
217 -->
218   <domain name="access ticket" type="short">
219     access ticket granted by server
220     <doc>
221     An access ticket granted by the server for a certain set of access
222     rights within a specific realm. Access tickets are valid within the
223     channel where they were created, and expire when the channel closes.
224     </doc>
225     <assert check="ne" value="0"/>
226   </domain>
227   <domain name="class id" type="short"/>
228   <domain name="consumer tag" type="shortstr">
229     consumer tag
230     <doc>
231       Identifier for the consumer, valid within the current connection.
232     </doc>
233     <rule implement="MUST">
234       The consumer tag is valid only within the channel from which the
235       consumer was created. I.e. a client MUST NOT create a consumer in
236       one channel and then use it in another.
237     </rule>
238   </domain>
239   <domain name="delivery tag" type="longlong">
240     server-assigned delivery tag
241     <doc>
242       The server-assigned and channel-specific delivery tag
243     </doc>
244     <rule implement="MUST">
245       The delivery tag is valid only within the channel from which the
246       message was received.  I.e. a client MUST NOT receive a message on
247       one channel and then acknowledge it on another.
248     </rule>
249     <rule implement="MUST">
250       The server MUST NOT use a zero value for delivery tags.  Zero is
251       reserved for client use, meaning "all messages so far received".
252     </rule>
253   </domain>
254   <domain name="exchange name" type="shortstr">
255     exchange name
256     <doc>
257       The exchange name is a client-selected string that identifies
258       the exchange for publish methods.  Exchange names may consist
259       of any mixture of digits, letters, and underscores.  Exchange
260       names are scoped by the virtual host.
261     </doc>
262     <assert check="length" value="127"/>
263   </domain>
264   <domain name="known hosts" type="shortstr">
265 list of known hosts
266 <doc>
267 Specifies the list of equivalent or alternative hosts that the server
268 knows about, which will normally include the current server itself.
269 Clients can cache this information and use it when reconnecting to a
270 server after a failure.
271 </doc>
272     <rule implement="MAY">
273 The server MAY leave this field empty if it knows of no other
274 hosts than itself.
275 </rule>
276   </domain>
277   <domain name="method id" type="short"/>
278   <domain name="no ack" type="bit">
279     no acknowledgement needed
280     <doc>
281       If this field is set the server does not expect acknowledgments
282       for messages.  That is, when a message is delivered to the client
283       the server automatically and silently acknowledges it on behalf
284       of the client.  This functionality increases performance but at
285       the cost of reliability.  Messages can get lost if a client dies
286       before it can deliver them to the application.
287     </doc>
288   </domain>
289   <domain name="no local" type="bit">
290     do not deliver own messages
291     <doc>
292     If the no-local field is set the server will not send messages to
293     the client that published them.
294     </doc>
295   </domain>
296   <domain name="path" type="shortstr">
297     <doc>
298   Must start with a slash "/" and continue with path names
299   separated by slashes. A path name consists of any combination
300   of at least one of [A-Za-z0-9] plus zero or more of [.-_+!=:].
301 </doc>
302     <assert check="notnull"/>
303     <assert check="syntax" rule="path"/>
304     <assert check="length" value="127"/>
305   </domain>
306   <domain name="peer properties" type="table">
307     <doc>
308 This string provides a set of peer properties, used for
309 identification, debugging, and general information.
310 </doc>
311     <rule implement="SHOULD">
312 The properties SHOULD contain these fields:
313 "product", giving the name of the peer product, "version", giving
314 the name of the peer version, "platform", giving the name of the
315 operating system, "copyright", if appropriate, and "information",
316 giving other general information.
317 </rule>
318   </domain>
319   <domain name="queue name" type="shortstr">
320     queue name
321     <doc>
322     The queue name identifies the queue within the vhost.  Queue
323     names may consist of any mixture of digits, letters, and
324     underscores.
325     </doc>
326     <assert check="length" value="127"/>
327   </domain>
328   <domain name="redelivered" type="bit">
329     message is being redelivered
330     <doc>
331       This indicates that the message has been previously delivered to
332       this or another client.
333     </doc>
334     <rule implement="SHOULD">
335       The server SHOULD try to signal redelivered messages when it can.
336       When redelivering a message that was not successfully acknowledged,
337       the server SHOULD deliver it to the original client if possible.
338     </rule>
339     <rule implement="MUST">
340       The client MUST NOT rely on the redelivered field but MUST take it
341       as a hint that the message may already have been processed.  A
342       fully robust client must be able to track duplicate received messages
343       on non-transacted, and locally-transacted channels.
344     </rule>
345   </domain>
346   <domain name="reply code" type="short">
347 reply code from server
348 <doc>
349   The reply code. The AMQ reply codes are defined in AMQ RFC 011.
350 </doc>
351     <assert check="notnull"/>
352   </domain>
353   <domain name="reply text" type="shortstr">
354 localised reply text
355 <doc>
356   The localised reply text.  This text can be logged as an aid to
357   resolving issues.
358 </doc>
359     <assert check="notnull"/>
360   </domain>
361   <class name="connection" handler="connection" index="10">
362     <!--
363 ======================================================
364 ==       CONNECTION
365 ======================================================
366 -->
367   work with socket connections
368 <doc>
369   The connection class provides methods for a client to establish a
370   network connection to a server, and for both peers to operate the
371   connection thereafter.
372 </doc>
373     <doc name="grammar">
374     connection          = open-connection *use-connection close-connection
375     open-connection     = C:protocol-header
376                           S:START C:START-OK
377                           *challenge
378                           S:TUNE C:TUNE-OK
379                           C:OPEN S:OPEN-OK | S:REDIRECT
380     challenge           = S:SECURE C:SECURE-OK
381     use-connection      = *channel
382     close-connection    = C:CLOSE S:CLOSE-OK
383                         / S:CLOSE C:CLOSE-OK
384 </doc>
385     <chassis name="server" implement="MUST"/>
386     <chassis name="client" implement="MUST"/>
387     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
388     <method name="start" synchronous="1" index="10">
389   start connection negotiation
390   <doc>
391     This method starts the connection negotiation process by telling
392     the client the protocol version that the server proposes, along
393     with a list of security mechanisms which the client can use for
394     authentication.
395   </doc>
396       <rule implement="MUST">
397     If the client cannot handle the protocol version suggested by the
398     server it MUST close the socket connection.
399   </rule>
400       <rule implement="MUST">
401     The server MUST provide a protocol version that is lower than or
402     equal to that requested by the client in the protocol header. If
403     the server cannot support the specified protocol it MUST NOT send
404     this method, but MUST close the socket connection.
405   </rule>
406       <chassis name="client" implement="MUST"/>
407       <response name="start-ok"/>
408       <field name="version major" type="octet">
409     protocol major version
410     <doc>
411       The protocol major version that the server agrees to use, which
412       cannot be higher than the client's major version.
413     </doc>
414       </field>
415       <field name="version minor" type="octet">
416     protocol major version
417     <doc>
418       The protocol minor version that the server agrees to use, which
419       cannot be higher than the client's minor version.
420     </doc>
421       </field>
422       <field name="server properties" domain="peer properties">
423     server properties
424   </field>
425       <field name="mechanisms" type="longstr">
426     available security mechanisms
427     <doc>
428       A list of the security mechanisms that the server supports, delimited
429       by spaces.  Currently ASL supports these mechanisms: PLAIN.
430     </doc>
431         <see name="security mechanisms"/>
432         <assert check="notnull"/>
433       </field>
434       <field name="locales" type="longstr">
435     available message locales
436     <doc>
437       A list of the message locales that the server supports, delimited
438       by spaces.  The locale defines the language in which the server
439       will send reply texts.
440     </doc>
441         <rule implement="MUST">
442       All servers MUST support at least the en_US locale.
443     </rule>
444         <assert check="notnull"/>
445       </field>
446     </method>
447     <method name="start-ok" synchronous="1" index="11">
448   select security mechanism and locale
449   <doc>
450     This method selects a SASL security mechanism. ASL uses SASL
451     (RFC2222) to negotiate authentication and encryption.
452   </doc>
453       <chassis name="server" implement="MUST"/>
454       <field name="client properties" domain="peer properties">
455     client properties
456   </field>
457       <field name="mechanism" type="shortstr">
458     selected security mechanism
459     <doc>
460       A single security mechanisms selected by the client, which must be
461       one of those specified by the server.
462     </doc>
463         <rule implement="SHOULD">
464       The client SHOULD authenticate using the highest-level security
465       profile it can handle from the list provided by the server.
466     </rule>
467         <rule implement="MUST">
468     The mechanism field MUST contain one of the security mechanisms
469     proposed by the server in the Start method. If it doesn't, the
470     server MUST close the socket.
471     </rule>
472         <assert check="notnull"/>
473       </field>
474       <field name="response" type="longstr">
475     security response data
476     <doc>
477       A block of opaque data passed to the security mechanism. The contents
478       of this data are defined by the SASL security mechanism.  For the
479       PLAIN security mechanism this is defined as a field table holding
480       two fields, LOGIN and PASSWORD.
481     </doc>
482         <assert check="notnull"/>
483       </field>
484       <field name="locale" type="shortstr">
485     selected message locale
486     <doc>
487       A single message local selected by the client, which must be one
488       of those specified by the server.
489     </doc>
490         <assert check="notnull"/>
491       </field>
492     </method>
493     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
494     <method name="secure" synchronous="1" index="20">
495   security mechanism challenge
496   <doc>
497     The SASL protocol works by exchanging challenges and responses until
498     both peers have received sufficient information to authenticate each
499     other.  This method challenges the client to provide more information.
500   </doc>
501       <chassis name="client" implement="MUST"/>
502       <response name="secure-ok"/>
503       <field name="challenge" type="longstr">
504     security challenge data
505     <doc>
506       Challenge information, a block of opaque binary data passed to
507       the security mechanism.
508     </doc>
509         <see name="security mechanisms"/>
510       </field>
511     </method>
512     <method name="secure-ok" synchronous="1" index="21">
513   security mechanism response
514   <doc>
515     This method attempts to authenticate, passing a block of SASL data
516     for the security mechanism at the server side.
517   </doc>
518       <chassis name="server" implement="MUST"/>
519       <field name="response" type="longstr">
520     security response data
521     <doc>
522       A block of opaque data passed to the security mechanism.  The contents
523       of this data are defined by the SASL security mechanism.
524     </doc>
525         <assert check="notnull"/>
526       </field>
527     </method>
528     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
529     <method name="tune" synchronous="1" index="30">
530   propose connection tuning parameters
531   <doc>
532     This method proposes a set of connection configuration values
533     to the client.  The client can accept and/or adjust these.
534   </doc>
535       <chassis name="client" implement="MUST"/>
536       <response name="tune-ok"/>
537       <field name="channel max" type="short">
538     proposed maximum channels
539     <doc>
540       The maximum total number of channels that the server allows
541       per connection. Zero means that the server does not impose a
542       fixed limit, but the number of allowed channels may be limited
543       by available server resources.
544     </doc>
545       </field>
546       <field name="frame max" type="long">
547     proposed maximum frame size
548     <doc>
549       The largest frame size that the server proposes for the
550       connection. The client can negotiate a lower value.  Zero means
551       that the server does not impose any specific limit but may reject
552       very large frames if it cannot allocate resources for them.
553     </doc>
554         <rule implement="MUST">
555       Until the frame-max has been negotiated, both peers MUST accept
556       frames of up to 4096 octets large. The minimum non-zero value for
557       the frame-max field is 4096.
558     </rule>
559       </field>
560       <field name="heartbeat" type="short">
561     desired heartbeat delay
562     <doc>
563       The delay, in seconds, of the connection heartbeat that the server
564       wants.  Zero means the server does not want a heartbeat.
565     </doc>
566       </field>
567     </method>
568     <method name="tune-ok" synchronous="1" index="31">
569   negotiate connection tuning parameters
570   <doc>
571     This method sends the client's connection tuning parameters to the
572     server. Certain fields are negotiated, others provide capability
573     information.
574   </doc>
575       <chassis name="server" implement="MUST"/>
576       <field name="channel max" type="short">
577     negotiated maximum channels
578     <doc>
579       The maximum total number of channels that the client will use
580       per connection.  May not be higher than the value specified by
581       the server.
582     </doc>
583         <rule implement="MAY">
584       The server MAY ignore the channel-max value or MAY use it for
585       tuning its resource allocation.
586     </rule>
587         <assert check="notnull"/>
588         <assert check="le" method="tune" field="channel max"/>
589       </field>
590       <field name="frame max" type="long">
591     negotiated maximum frame size
592     <doc>
593       The largest frame size that the client and server will use for
594       the connection.  Zero means that the client does not impose any
595       specific limit but may reject very large frames if it cannot
596       allocate resources for them.  Note that the frame-max limit
597       applies principally to content frames, where large contents
598       can be broken into frames of arbitrary size.
599     </doc>
600         <rule implement="MUST">
601       Until the frame-max has been negotiated, both peers must accept
602       frames of up to 4096 octets large. The minimum non-zero value for
603       the frame-max field is 4096.
604     </rule>
605       </field>
606       <field name="heartbeat" type="short">
607     desired heartbeat delay
608     <doc>
609       The delay, in seconds, of the connection heartbeat that the client
610       wants. Zero means the client does not want a heartbeat.
611     </doc>
612       </field>
613     </method>
614     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
615     <method name="open" synchronous="1" index="40">
616   open connection to virtual host
617   <doc>
618     This method opens a connection to a virtual host, which is a
619     collection of resources, and acts to separate multiple application
620     domains within a server.
621   </doc>
622       <rule implement="MUST">
623     The client MUST open the context before doing any work on the
624     connection.
625   </rule>
626       <chassis name="server" implement="MUST"/>
627       <response name="open-ok"/>
628       <response name="redirect"/>
629       <field name="virtual host" domain="path">
630     virtual host name
631     <assert check="regexp" value="^[a-zA-Z0-9/-_]+$"/>
632         <doc>
633       The name of the virtual host to work with.
634     </doc>
635         <rule implement="MUST">
636       If the server supports multiple virtual hosts, it MUST enforce a
637       full separation of exchanges, queues, and all associated entities
638       per virtual host. An application, connected to a specific virtual
639       host, MUST NOT be able to access resources of another virtual host.
640     </rule>
641         <rule implement="SHOULD">
642       The server SHOULD verify that the client has permission to access
643       the specified virtual host.
644     </rule>
645         <rule implement="MAY">
646       The server MAY configure arbitrary limits per virtual host, such
647       as the number of each type of entity that may be used, per
648       connection and/or in total.
649     </rule>
650       </field>
651       <field name="capabilities" type="shortstr">
652     required capabilities
653     <doc>
654       The client may specify a number of capability names, delimited by
655       spaces.  The server can use this string to how to process the
656       client's connection request.
657     </doc>
658       </field>
659       <field name="insist" type="bit">
660     insist on connecting to server
661     <doc>
662       In a configuration with multiple load-sharing servers, the server
663       may respond to a Connection.Open method with a Connection.Redirect.
664       The insist option tells the server that the client is insisting on
665       a connection to the specified server.
666     </doc>
667         <rule implement="SHOULD">
668       When the client uses the insist option, the server SHOULD accept
669       the client connection unless it is technically unable to do so.
670     </rule>
671       </field>
672     </method>
673     <method name="open-ok" synchronous="1" index="41">
674   signal that the connection is ready
675   <doc>
676     This method signals to the client that the connection is ready for
677     use.
678   </doc>
679       <chassis name="client" implement="MUST"/>
680       <field name="known hosts" domain="known hosts"/>
681     </method>
682     <method name="redirect" synchronous="1" index="50">
683   asks the client to use a different server
684   <doc>
685     This method redirects the client to another server, based on the
686     requested virtual host and/or capabilities.
687   </doc>
688       <rule implement="SHOULD">
689     When getting the Connection.Redirect method, the client SHOULD
690     reconnect to the host specified, and if that host is not present,
691     to any of the hosts specified in the known-hosts list.
692   </rule>
693       <chassis name="client" implement="MAY"/>
694       <field name="host" type="shortstr">
695     server to connect to
696     <doc>
697       Specifies the server to connect to.  This is an IP address or a
698       DNS name, optionally followed by a colon and a port number. If
699       no port number is specified, the client should use the default
700       port number for the protocol.
701     </doc>
702         <assert check="notnull"/>
703       </field>
704       <field name="known hosts" domain="known hosts"/>
705     </method>
706     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
707     <method name="close" synchronous="1" index="60">
708   request a connection close
709   <doc>
710     This method indicates that the sender wants to close the connection.
711     This may be due to internal conditions (e.g. a forced shut-down) or
712     due to an error handling a specific method, i.e. an exception.  When
713     a close is due to an exception, the sender provides the class and
714     method id of the method which caused the exception.
715   </doc>
716       <rule implement="MUST">
717     After sending this method any received method except the Close-OK
718     method MUST be discarded.
719   </rule>
720       <rule implement="MAY">
721     The peer sending this method MAY use a counter or timeout to
722     detect failure of the other peer to respond correctly with
723     the Close-OK method.
724   </rule>
725       <rule implement="MUST">
726     When a server receives the Close method from a client it MUST
727     delete all server-side resources associated with the client's
728     context.  A client CANNOT reconnect to a context after sending
729     or receiving a Close method.
730   </rule>
731       <chassis name="client" implement="MUST"/>
732       <chassis name="server" implement="MUST"/>
733       <response name="close-ok"/>
734       <field name="reply code" domain="reply code"/>
735       <field name="reply text" domain="reply text"/>
736       <field name="class id" domain="class id">
737     failing method class
738     <doc>
739       When the close is provoked by a method exception, this is the
740       class of the method.
741     </doc>
742       </field>
743       <field name="method id" domain="class id">
744     failing method ID
745     <doc>
746       When the close is provoked by a method exception, this is the
747       ID of the method.
748     </doc>
749       </field>
750     </method>
751     <method name="close-ok" synchronous="1" index="61">
752   confirm a connection close
753   <doc>
754     This method confirms a Connection.Close method and tells the
755     recipient that it is safe to release resources for the connection
756     and close the socket.
757   </doc>
758       <rule implement="SHOULD">
759     A peer that detects a socket closure without having received a
760     Close-Ok handshake method SHOULD log the error.
761   </rule>
762       <chassis name="client" implement="MUST"/>
763       <chassis name="server" implement="MUST"/>
764     </method>
765   </class>
766   <class name="channel" handler="channel" index="20">
767     <!--
768 ======================================================
769 ==       CHANNEL
770 ======================================================
771 -->
772   work with channels
773 <doc>
774   The channel class provides methods for a client to establish a virtual
775   connection - a channel - to a server and for both peers to operate the
776   virtual connection thereafter.
777 </doc>
778     <doc name="grammar">
779     channel             = open-channel *use-channel close-channel
780     open-channel        = C:OPEN S:OPEN-OK
781     use-channel         = C:FLOW S:FLOW-OK
782                         / S:FLOW C:FLOW-OK
783                         / S:ALERT
784                         / functional-class
785     close-channel       = C:CLOSE S:CLOSE-OK
786                         / S:CLOSE C:CLOSE-OK
787 </doc>
788     <chassis name="server" implement="MUST"/>
789     <chassis name="client" implement="MUST"/>
790     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
791     <method name="open" synchronous="1" index="10">
792   open a channel for use
793   <doc>
794     This method opens a virtual connection (a channel).
795   </doc>
796       <rule implement="MUST">
797     This method MUST NOT be called when the channel is already open.
798   </rule>
799       <chassis name="server" implement="MUST"/>
800       <response name="open-ok"/>
801       <field name="out of band" type="shortstr">
802     out-of-band settings
803     <doc>
804       Configures out-of-band transfers on this channel.  The syntax and
805       meaning of this field will be formally defined at a later date.
806     </doc>
807         <assert check="null"/>
808       </field>
809     </method>
810     <method name="open-ok" synchronous="1" index="11">
811   signal that the channel is ready
812   <doc>
813     This method signals to the client that the channel is ready for use.
814   </doc>
815       <chassis name="client" implement="MUST"/>
816     </method>
817     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
818     <method name="flow" synchronous="1" index="20">
819   enable/disable flow from peer
820   <doc>
821     This method asks the peer to pause or restart the flow of content
822     data. This is a simple flow-control mechanism that a peer can use
823     to avoid oveflowing its queues or otherwise finding itself receiving
824     more messages than it can process.  Note that this method is not
825     intended for window control.  The peer that receives a request to
826     stop sending content should finish sending the current content, if
827     any, and then wait until it receives a Flow restart method.
828   </doc>
829       <rule implement="MAY">
830     When a new channel is opened, it is active.  Some applications
831     assume that channels are inactive until started.  To emulate this
832     behaviour a client MAY open the channel, then pause it.
833   </rule>
834       <rule implement="SHOULD">
835     When sending content data in multiple frames, a peer SHOULD monitor
836     the channel for incoming methods and respond to a Channel.Flow as
837     rapidly as possible.
838   </rule>
839       <rule implement="MAY">
840     A peer MAY use the Channel.Flow method to throttle incoming content
841     data for internal reasons, for example, when exchangeing data over a
842     slower connection.
843   </rule>
844       <rule implement="MAY">
845     The peer that requests a Channel.Flow method MAY disconnect and/or
846     ban a peer that does not respect the request.
847   </rule>
848       <chassis name="server" implement="MUST"/>
849       <chassis name="client" implement="MUST"/>
850       <response name="flow-ok"/>
851       <field name="active" type="bit">
852     start/stop content frames
853     <doc>
854       If 1, the peer starts sending content frames.  If 0, the peer
855       stops sending content frames.
856     </doc>
857       </field>
858     </method>
859     <method name="flow-ok" index="21">
860   confirm a flow method
861   <doc>
862     Confirms to the peer that a flow command was received and processed.
863   </doc>
864       <chassis name="server" implement="MUST"/>
865       <chassis name="client" implement="MUST"/>
866       <field name="active" type="bit">
867     current flow setting
868     <doc>
869       Confirms the setting of the processed flow method: 1 means the
870       peer will start sending or continue to send content frames; 0
871       means it will not.
872     </doc>
873       </field>
874     </method>
875     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
876     <method name="alert" index="30">
877   send a non-fatal warning message
878   <doc>
879     This method allows the server to send a non-fatal warning to the
880     client.  This is used for methods that are normally asynchronous
881     and thus do not have confirmations, and for which the server may
882     detect errors that need to be reported.  Fatal errors are handled
883     as channel or connection exceptions; non-fatal errors are sent
884     through this method.
885   </doc>
886       <chassis name="client" implement="MUST"/>
887       <field name="reply code" domain="reply code"/>
888       <field name="reply text" domain="reply text"/>
889       <field name="details" type="table">
890     detailed information for warning
891     <doc>
892       A set of fields that provide more information about the
893       problem.  The meaning of these fields are defined on a
894       per-reply-code basis (TO BE DEFINED).
895     </doc>
896       </field>
897     </method>
898     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
899     <method name="close" synchronous="1" index="40">
900   request a channel close
901   <doc>
902     This method indicates that the sender wants to close the channel.
903     This may be due to internal conditions (e.g. a forced shut-down) or
904     due to an error handling a specific method, i.e. an exception.  When
905     a close is due to an exception, the sender provides the class and
906     method id of the method which caused the exception.
907   </doc>
908       <rule implement="MUST">
909     After sending this method any received method except
910     Channel.Close-OK MUST be discarded.
911   </rule>
912       <rule implement="MAY">
913     The peer sending this method MAY use a counter or timeout to detect
914     failure of the other peer to respond correctly with Channel.Close-OK..
915   </rule>
916       <chassis name="client" implement="MUST"/>
917       <chassis name="server" implement="MUST"/>
918       <response name="close-ok"/>
919       <field name="reply code" domain="reply code"/>
920       <field name="reply text" domain="reply text"/>
921       <field name="class id" domain="class id">
922     failing method class
923     <doc>
924       When the close is provoked by a method exception, this is the
925       class of the method.
926     </doc>
927       </field>
928       <field name="method id" domain="method id">
929     failing method ID
930     <doc>
931       When the close is provoked by a method exception, this is the
932       ID of the method.
933     </doc>
934       </field>
935     </method>
936     <method name="close-ok" synchronous="1" index="41">
937   confirm a channel close
938   <doc>
939     This method confirms a Channel.Close method and tells the recipient
940     that it is safe to release resources for the channel and close the
941     socket.
942   </doc>
943       <rule implement="SHOULD">
944     A peer that detects a socket closure without having received a
945     Channel.Close-Ok handshake method SHOULD log the error.
946   </rule>
947       <chassis name="client" implement="MUST"/>
948       <chassis name="server" implement="MUST"/>
949     </method>
950   </class>
951   <class name="access" handler="connection" index="30">
952     <!--
953 ======================================================
954 ==      ACCESS CONTROL
955 ======================================================
956 -->
957   work with access tickets
958 <doc>
959   The protocol control access to server resources using access tickets.
960   A client must explicitly request access tickets before doing work.
961   An access ticket grants a client the right to use a specific set of
962   resources - called a "realm" - in specific ways.
963 </doc>
964     <doc name="grammar">
965     access              = C:REQUEST S:REQUEST-OK
966 </doc>
967     <chassis name="server" implement="MUST"/>
968     <chassis name="client" implement="MUST"/>
969     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
970     <method name="request" synchronous="1" index="10">
971   request an access ticket
972   <doc>
973     This method requests an access ticket for an access realm.
974     The server responds by granting the access ticket.  If the
975     client does not have access rights to the requested realm
976     this causes a connection exception.  Access tickets are a
977     per-channel resource.
978   </doc>
979       <rule implement="MUST">
980     The realm name MUST start with either "/data" (for application
981     resources) or "/admin" (for server administration resources).
982     If the realm starts with any other path, the server MUST raise
983     a connection exception with reply code 403 (access refused).
984   </rule>
985       <rule implement="MUST">
986     The server MUST implement the /data realm and MAY implement the
987     /admin realm.  The mapping of resources to realms is not
988     defined in the protocol - this is a server-side configuration
989     issue.
990   </rule>
991       <chassis name="server" implement="MUST"/>
992       <response name="request-ok"/>
993       <field name="realm" domain="path">
994     name of requested realm
995     <rule implement="MUST">
996       If the specified realm is not known to the server, the server
997       must raise a channel exception with reply code 402 (invalid
998       path).
999     </rule>
1000       </field>
1001       <field name="exclusive" type="bit">
1002     request exclusive access
1003     <doc>
1004       Request exclusive access to the realm. If the server cannot grant
1005       this - because there are other active tickets for the realm - it
1006       raises a channel exception.
1007     </doc>
1008       </field>
1009       <field name="passive" type="bit">
1010     request passive access
1011     <doc>
1012       Request message passive access to the specified access realm.
1013       Passive access lets a client get information about resources in
1014       the realm but not to make any changes to them.
1015     </doc>
1016       </field>
1017       <field name="active" type="bit">
1018     request active access
1019     <doc>
1020       Request message active access to the specified access realm.
1021       Acvtive access lets a client get create and delete resources in
1022       the realm.
1023     </doc>
1024       </field>
1025       <field name="write" type="bit">
1026     request write access
1027     <doc>
1028       Request write access to the specified access realm.  Write access
1029       lets a client publish messages to all exchanges in the realm.
1030     </doc>
1031       </field>
1032       <field name="read" type="bit">
1033     request read access
1034     <doc>
1035       Request read access to the specified access realm.  Read access
1036       lets a client consume messages from queues in the realm.
1037     </doc>
1038       </field>
1039     </method>
1040     <method name="request-ok" synchronous="1" index="11">
1041   grant access to server resources
1042   <doc>
1043     This method provides the client with an access ticket. The access
1044     ticket is valid within the current channel and for the lifespan of
1045     the channel.
1046   </doc>
1047       <rule implement="MUST">
1048     The client MUST NOT use access tickets except within the same
1049     channel as originally granted.
1050   </rule>
1051       <rule implement="MUST">
1052     The server MUST isolate access tickets per channel and treat an
1053     attempt by a client to mix these as a connection exception.
1054   </rule>
1055       <chassis name="client" implement="MUST"/>
1056       <field name="ticket" domain="access ticket"/>
1057     </method>
1058   </class>
1059   <class name="exchange" handler="channel" index="40">
1060     <!--
1061 ======================================================
1062 ==       EXCHANGES (or "routers", if you prefer)
1063 ==       (Or matchers, plugins, extensions, agents,... Routing is just one of
1064 ==        the many fun things an exchange can do.)
1065 ======================================================
1066 -->
1067   work with exchanges
1068 <doc>
1069   Exchanges match and distribute messages across queues.  Exchanges can be
1070   configured in the server or created at runtime.
1071 </doc>
1072     <doc name="grammar">
1073     exchange            = C:DECLARE  S:DECLARE-OK
1074                         / C:DELETE   S:DELETE-OK
1075 </doc>
1076     <chassis name="server" implement="MUST"/>
1077     <chassis name="client" implement="MUST"/>
1078     <rule implement="MUST">
1079       <test>amq_exchange_19</test>
1080   The server MUST implement the direct and fanout exchange types, and
1081   predeclare the corresponding exchanges named amq.direct and amq.fanout
1082   in each virtual host. The server MUST also predeclare a direct
1083   exchange to act as the default exchange for content Publish methods
1084   and for default queue bindings.
1085 </rule>
1086     <rule implement="SHOULD">
1087       <test>amq_exchange_20</test>
1088   The server SHOULD implement the topic exchange type, and predeclare
1089   the corresponding exchange named amq.topic in each virtual host.
1090 </rule>
1091     <rule implement="MAY">
1092       <test>amq_exchange_21</test>
1093   The server MAY implement the system exchange type, and predeclare the
1094   corresponding exchanges named amq.system in each virtual host. If the
1095   client attempts to bind a queue to the system exchange, the server
1096   MUST raise a connection exception with reply code 507 (not allowed).
1097 </rule>
1098     <rule implement="MUST">
1099       <test>amq_exchange_22</test>
1100   The default exchange MUST be defined as internal, and be inaccessible
1101   to the client except by specifying an empty exchange name in a content
1102   Publish method. That is, the server MUST NOT let clients make explicit
1103   bindings to this exchange.
1104 </rule>
1105     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1106     <method name="declare" synchronous="1" index="10">
1107   declare exchange, create if needed
1108   <doc>
1109     This method creates an exchange if it does not already exist, and if the
1110     exchange exists, verifies that it is of the correct and expected class.
1111   </doc>
1112       <rule implement="SHOULD">
1113         <test>amq_exchange_23</test>
1114     The server SHOULD support a minimum of 16 exchanges per virtual host
1115     and ideally, impose no limit except as defined by available resources.
1116   </rule>
1117       <chassis name="server" implement="MUST"/>
1118       <response name="declare-ok"/>
1119       <field name="ticket" domain="access ticket">
1120         <doc>
1121       When a client defines a new exchange, this belongs to the access realm
1122       of the ticket used.  All further work done with that exchange must be
1123       done with an access ticket for the same realm.
1124     </doc>
1125         <rule implement="MUST">
1126       The client MUST provide a valid access ticket giving "active" access
1127       to the realm in which the exchange exists or will be created, or
1128       "passive" access if the if-exists flag is set.
1129     </rule>
1130       </field>
1131       <field name="exchange" domain="exchange name">
1132         <rule implement="MUST">
1133           <test>amq_exchange_15</test>
1134       Exchange names starting with "amq." are reserved for predeclared
1135       and standardised exchanges.  If the client attempts to create an
1136       exchange starting with "amq.", the server MUST raise a channel
1137       exception with reply code 403 (access refused).
1138     </rule>
1139         <assert check="regexp" value="^[a-zA-Z0-9-_.:]+$"/>
1140       </field>
1141       <field name="type" type="shortstr">
1142     exchange type
1143     <doc>
1144       Each exchange belongs to one of a set of exchange types implemented
1145       by the server.  The exchange types define the functionality of the
1146       exchange - i.e. how messages are routed through it.  It is not valid
1147       or meaningful to attempt to change the type of an existing exchange.
1148     </doc>
1149         <rule implement="MUST">
1150           <test>amq_exchange_16</test>
1151       If the exchange already exists with a different type, the server
1152       MUST raise a connection exception with a reply code 507 (not allowed).
1153     </rule>
1154         <rule implement="MUST">
1155           <test>amq_exchange_18</test>
1156       If the server does not support the requested exchange type it MUST
1157       raise a connection exception with a reply code 503 (command invalid).
1158     </rule>
1159         <assert check="regexp" value="^[a-zA-Z0-9-_.:]+$"/>
1160       </field>
1161       <field name="passive" type="bit">
1162     do not create exchange
1163     <doc>
1164     If set, the server will not create the exchange.  The client can use
1165     this to check whether an exchange exists without modifying the server
1166     state.
1167     </doc>
1168         <rule implement="MUST">
1169           <test>amq_exchange_05</test>
1170       If set, and the exchange does not already exist, the server MUST
1171       raise a channel exception with reply code 404 (not found).
1172     </rule>
1173       </field>
1174       <field name="durable" type="bit">
1175     request a durable exchange
1176     <doc>
1177       If set when creating a new exchange, the exchange will be marked as
1178       durable.  Durable exchanges remain active when a server restarts.
1179       Non-durable exchanges (transient exchanges) are purged if/when a
1180       server restarts.
1181     </doc>
1182         <rule implement="MUST">
1183           <test>amq_exchange_24</test>
1184       The server MUST support both durable and transient exchanges.
1185     </rule>
1186         <rule implement="MUST">
1187       The server MUST ignore the durable field if the exchange already
1188       exists.
1189     </rule>
1190       </field>
1191       <field name="auto delete" type="bit">
1192     auto-delete when unused
1193     <doc>
1194       If set, the exchange is deleted when all queues have finished
1195       using it.
1196     </doc>
1197         <rule implement="SHOULD">
1198           <test>amq_exchange_02</test>
1199       The server SHOULD allow for a reasonable delay between the point
1200       when it determines that an exchange is not being used (or no longer
1201       used), and the point when it deletes the exchange.  At the least it
1202       must allow a client to create an exchange and then bind a queue to
1203       it, with a small but non-zero delay between these two actions.
1204     </rule>
1205         <rule implement="MUST">
1206           <test>amq_exchange_25</test>
1207       The server MUST ignore the auto-delete field if the exchange already
1208       exists.
1209     </rule>
1210       </field>
1211       <field name="internal" type="bit">
1212     create internal exchange
1213     <doc>
1214       If set, the exchange may not be used directly by publishers, but
1215       only when bound to other exchanges. Internal exchanges are used to
1216       construct wiring that is not visible to applications.
1217     </doc>
1218       </field>
1219
1220   <field name = "nowait" type = "bit">
1221     do not send a reply method
1222     <doc>
1223     If set, the server will not respond to the method. The client should
1224     not wait for a reply method.  If the server could not complete the
1225     method it will raise a channel or connection exception.
1226     </doc>
1227   </field>
1228
1229       <field name="arguments" type="table">
1230     arguments for declaration
1231     <doc>
1232       A set of arguments for the declaration. The syntax and semantics
1233       of these arguments depends on the server implementation.  This
1234       field is ignored if passive is 1.
1235     </doc>
1236       </field>
1237     </method>
1238     <method name="declare-ok" synchronous="1" index="11">
1239   confirms an exchange declaration
1240   <doc>
1241     This method confirms a Declare method and confirms the name of the
1242     exchange, essential for automatically-named exchanges.
1243   </doc>
1244       <chassis name="client" implement="MUST"/>
1245     </method>
1246     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1247     <method name="delete" synchronous="1" index="20">
1248   delete an exchange
1249   <doc>
1250     This method deletes an exchange.  When an exchange is deleted all queue
1251     bindings on the exchange are cancelled.
1252   </doc>
1253       <chassis name="server" implement="MUST"/>
1254       <response name="delete-ok"/>
1255       <field name="ticket" domain="access ticket">
1256         <rule implement="MUST">
1257       The client MUST provide a valid access ticket giving "active"
1258       access rights to the exchange's access realm.
1259     </rule>
1260       </field>
1261       <field name="exchange" domain="exchange name">
1262         <rule implement="MUST">
1263           <test>amq_exchange_11</test>
1264       The exchange MUST exist. Attempting to delete a non-existing exchange
1265       causes a channel exception.
1266     </rule>
1267         <assert check="notnull"/>
1268       </field>
1269       <field name="if unused" type="bit">
1270     delete only if unused
1271     <doc>
1272       If set, the server will only delete the exchange if it has no queue
1273       bindings. If the exchange has queue bindings the server does not
1274       delete it but raises a channel exception instead.
1275     </doc>
1276         <rule implement="SHOULD">
1277           <test>amq_exchange_12</test>
1278       If set, the server SHOULD delete the exchange but only if it has
1279       no queue bindings.
1280     </rule>
1281         <rule implement="SHOULD">
1282           <test>amq_exchange_13</test>
1283       If set, the server SHOULD raise a channel exception if the exchange is in
1284       use.
1285     </rule>
1286       </field>
1287
1288   <field name = "nowait" type = "bit">
1289     do not send a reply method
1290     <doc>
1291     If set, the server will not respond to the method. The client should
1292     not wait for a reply method.  If the server could not complete the
1293     method it will raise a channel or connection exception.
1294     </doc>
1295   </field>
1296
1297     </method>
1298     <method name="delete-ok" synchronous="1" index="21">
1299   confirm deletion of an exchange
1300   <doc>
1301     This method confirms the deletion of an exchange.
1302   </doc>
1303       <chassis name="client" implement="MUST"/>
1304     </method>
1305   </class>
1306   <class name="queue" handler="channel" index="50">
1307     <!--
1308 ======================================================
1309 ==       QUEUES
1310 ======================================================
1311 -->
1312   work with queues
1313
1314 <doc>
1315   Queues store and forward messages.  Queues can be configured in the server
1316   or created at runtime.  Queues must be attached to at least one exchange
1317   in order to receive messages from publishers.
1318 </doc>
1319     <doc name="grammar">
1320     queue               = C:DECLARE  S:DECLARE-OK
1321                         / C:BIND     S:BIND-OK
1322                         / C:PURGE    S:PURGE-OK
1323                         / C:DELETE   S:DELETE-OK
1324 </doc>
1325     <chassis name="server" implement="MUST"/>
1326     <chassis name="client" implement="MUST"/>
1327     <rule implement="MUST">
1328       <test>amq_queue_33</test>
1329   A server MUST allow any content class to be sent to any queue, in any
1330   mix, and queue and delivery these content classes independently. Note
1331   that all methods that fetch content off queues are specific to a given
1332   content class.
1333 </rule>
1334     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1335     <method name="declare" synchronous="1" index="10">
1336   declare queue, create if needed
1337   <doc>
1338     This method creates or checks a queue.  When creating a new queue
1339     the client can specify various properties that control the durability
1340     of the queue and its contents, and the level of sharing for the queue.
1341   </doc>
1342       <rule implement="MUST">
1343         <test>amq_queue_34</test>
1344     The server MUST create a default binding for a newly-created queue
1345     to the default exchange, which is an exchange of type 'direct'.
1346   </rule>
1347       <rule implement="SHOULD">
1348         <test>amq_queue_35</test>
1349     The server SHOULD support a minimum of 256 queues per virtual host
1350     and ideally, impose no limit except as defined by available resources.
1351   </rule>
1352       <chassis name="server" implement="MUST"/>
1353       <response name="declare-ok"/>
1354       <field name="ticket" domain="access ticket">
1355         <doc>
1356       When a client defines a new queue, this belongs to the access realm
1357       of the ticket used.  All further work done with that queue must be
1358       done with an access ticket for the same realm.
1359     </doc>
1360         <doc>
1361       The client provides a valid access ticket giving "active" access
1362       to the realm in which the queue exists or will be created, or
1363       "passive" access if the if-exists flag is set.
1364     </doc>
1365       </field>
1366       <field name="queue" domain="queue name">
1367         <rule implement="MAY">
1368           <test>amq_queue_10</test>
1369       The queue name MAY be empty, in which case the server MUST create
1370       a new queue with a unique generated name and return this to the
1371       client in the Declare-Ok method.
1372     </rule>
1373         <rule implement="MUST">
1374           <test>amq_queue_32</test>
1375       Queue names starting with "amq." are reserved for predeclared and
1376       standardised server queues.  If the queue name starts with "amq."
1377       and the passive option is zero, the server MUST raise a connection
1378       exception with reply code 403 (access refused).
1379     </rule>
1380         <assert check="regexp" value="^[a-zA-Z0-9-_.:]*$"/>
1381       </field>
1382       <field name="passive" type="bit">
1383     do not create queue
1384     <doc>
1385     If set, the server will not create the queue.  The client can use
1386     this to check whether a queue exists without modifying the server
1387     state.
1388     </doc>
1389         <rule implement="MUST">
1390           <test>amq_queue_05</test>
1391       If set, and the queue does not already exist, the server MUST
1392       respond with a reply code 404 (not found) and raise a channel
1393       exception.
1394     </rule>
1395       </field>
1396       <field name="durable" type="bit">
1397     request a durable queue
1398     <doc>
1399       If set when creating a new queue, the queue will be marked as
1400       durable.  Durable queues remain active when a server restarts.
1401       Non-durable queues (transient queues) are purged if/when a
1402       server restarts.  Note that durable queues do not necessarily
1403       hold persistent messages, although it does not make sense to
1404       send persistent messages to a transient queue.
1405     </doc>
1406         <rule implement="MUST">
1407           <test>amq_queue_03</test>
1408       The server MUST recreate the durable queue after a restart.
1409     </rule>
1410         <rule implement="MUST">
1411           <test>amq_queue_36</test>
1412       The server MUST support both durable and transient queues.
1413     </rule>
1414         <rule implement="MUST">
1415           <test>amq_queue_37</test>
1416       The server MUST ignore the durable field if the queue already
1417       exists.
1418     </rule>
1419       </field>
1420       <field name="exclusive" type="bit">
1421     request an exclusive queue
1422     <doc>
1423       Exclusive queues may only be consumed from by the current connection.
1424       Setting the 'exclusive' flag always implies 'auto-delete'.
1425     </doc>
1426         <rule implement="MUST">
1427           <test>amq_queue_38</test>
1428       The server MUST support both exclusive (private) and non-exclusive
1429       (shared) queues.
1430     </rule>
1431         <rule implement="MUST">
1432           <test>amq_queue_04</test>
1433       The server MUST raise a channel exception if 'exclusive' is specified
1434       and the queue already exists and is owned by a different connection.
1435     </rule>
1436       </field>
1437       <field name="auto delete" type="bit">
1438     auto-delete queue when unused
1439     <doc>
1440       If set, the queue is deleted when all consumers have finished
1441       using it. Last consumer can be cancelled either explicitly or because
1442       its channel is closed. If there was no consumer ever on the queue, it
1443       won't be deleted.
1444     </doc>
1445         <rule implement="SHOULD">
1446           <test>amq_queue_02</test>
1447       The server SHOULD allow for a reasonable delay between the point
1448       when it determines that a queue is not being used (or no longer
1449       used), and the point when it deletes the queue.  At the least it
1450       must allow a client to create a queue and then create a consumer
1451       to read from it, with a small but non-zero delay between these
1452       two actions.  The server should equally allow for clients that may
1453       be disconnected prematurely, and wish to re-consume from the same
1454       queue without losing messages.  We would recommend a configurable
1455       timeout, with a suitable default value being one minute.
1456     </rule>
1457         <rule implement="MUST">
1458           <test>amq_queue_31</test>
1459       The server MUST ignore the auto-delete field if the queue already
1460       exists.
1461     </rule>
1462       </field>
1463   <field name = "nowait" type = "bit">
1464     do not send a reply method
1465     <doc>
1466     If set, the server will not respond to the method. The client should
1467     not wait for a reply method.  If the server could not complete the
1468     method it will raise a channel or connection exception.
1469     </doc>
1470   </field>
1471
1472       <field name="arguments" type="table">
1473     arguments for declaration
1474     <doc>
1475       A set of arguments for the declaration. The syntax and semantics
1476       of these arguments depends on the server implementation.  This
1477       field is ignored if passive is 1.
1478     </doc>
1479       </field>
1480     </method>
1481     <method name="declare-ok" synchronous="1" index="11">
1482   confirms a queue definition
1483   <doc>
1484     This method confirms a Declare method and confirms the name of the
1485     queue, essential for automatically-named queues.
1486   </doc>
1487       <chassis name="client" implement="MUST"/>
1488       <field name="queue" domain="queue name">
1489         <doc>
1490       Reports the name of the queue. If the server generated a queue
1491       name, this field contains that name.
1492     </doc>
1493         <assert check="notnull"/>
1494       </field>
1495       <field name="message count" type="long">
1496     number of messages in queue
1497     <doc>
1498       Reports the number of messages in the queue, which will be zero
1499       for newly-created queues.
1500     </doc>
1501       </field>
1502       <field name="consumer count" type="long">
1503     number of consumers
1504     <doc>
1505       Reports the number of active consumers for the queue. Note that
1506       consumers can suspend activity (Channel.Flow) in which case they
1507       do not appear in this count.
1508     </doc>
1509       </field>
1510     </method>
1511     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1512     <method name="bind" synchronous="1" index="20">
1513   bind queue to an exchange
1514   <doc>
1515     This method binds a queue to an exchange.  Until a queue is
1516     bound it will not receive any messages.  In a classic messaging
1517     model, store-and-forward queues are bound to a dest exchange
1518     and subscription queues are bound to a dest_wild exchange.
1519   </doc>
1520       <rule implement="MUST">
1521         <test>amq_queue_25</test>
1522     A server MUST allow ignore duplicate bindings - that is, two or
1523     more bind methods for a specific queue, with identical arguments
1524     - without treating these as an error.
1525   </rule>
1526       <rule implement="MUST">
1527         <test>amq_queue_39</test>
1528     If a bind fails, the server MUST raise a connection exception.
1529   </rule>
1530       <rule implement="MUST">
1531         <test>amq_queue_12</test>
1532     The server MUST NOT allow a durable queue to bind to a transient
1533     exchange. If the client attempts this the server MUST raise a
1534     channel exception.
1535   </rule>
1536       <rule implement="SHOULD">
1537         <test>amq_queue_13</test>
1538     Bindings for durable queues are automatically durable and the
1539     server SHOULD restore such bindings after a server restart.
1540   </rule>
1541       <rule implement="MUST">
1542         <test>amq_queue_17</test>
1543     If the client attempts to an exchange that was declared as internal,
1544     the server MUST raise a connection exception with reply code 530
1545     (not allowed).
1546   </rule>
1547       <rule implement="SHOULD">
1548         <test>amq_queue_40</test>
1549     The server SHOULD support at least 4 bindings per queue, and
1550     ideally, impose no limit except as defined by available resources.
1551   </rule>
1552       <chassis name="server" implement="MUST"/>
1553       <response name="bind-ok"/>
1554       <field name="ticket" domain="access ticket">
1555         <doc>
1556       The client provides a valid access ticket giving "active"
1557       access rights to the queue's access realm.
1558     </doc>
1559       </field>
1560
1561   <field name = "queue" domain = "queue name">
1562     <doc>
1563       Specifies the name of the queue to bind.  If the queue name is
1564       empty, refers to the current queue for the channel, which is
1565       the last declared queue.
1566     </doc>
1567     <doc name = "rule">
1568       If the client did not previously declare a queue, and the queue
1569       name in this method is empty, the server MUST raise a connection
1570       exception with reply code 530 (not allowed).
1571     </doc>
1572     <doc name = "rule" test = "amq_queue_26">
1573       If the queue does not exist the server MUST raise a channel exception
1574       with reply code 404 (not found).
1575     </doc>
1576   </field>
1577
1578   <field name="exchange" domain="exchange name">
1579           The name of the exchange to bind to.
1580           <rule implement="MUST">
1581           <test>amq_queue_14</test>
1582       If the exchange does not exist the server MUST raise a channel
1583       exception with reply code 404 (not found).
1584     </rule>
1585       </field>
1586       <field name="routing key" type="shortstr">
1587      message routing key
1588     <doc>
1589       Specifies the routing key for the binding.  The routing key is
1590       used for routing messages depending on the exchange configuration.
1591       Not all exchanges use a routing key - refer to the specific
1592       exchange documentation.  If the routing key is empty and the queue
1593       name is empty, the routing key will be the current queue for the
1594       channel, which is the last declared queue.
1595     </doc>
1596   </field>
1597
1598   <field name = "nowait" type = "bit">
1599     do not send a reply method
1600     <doc>
1601     If set, the server will not respond to the method. The client should
1602     not wait for a reply method.  If the server could not complete the
1603     method it will raise a channel or connection exception.
1604     </doc>
1605   </field>
1606
1607   <field name="arguments" type="table">
1608     arguments for binding
1609     <doc>
1610       A set of arguments for the binding.  The syntax and semantics of
1611       these arguments depends on the exchange class.
1612     </doc>
1613       </field>
1614     </method>
1615     <method name="bind-ok" synchronous="1" index="21">
1616   confirm bind successful
1617   <doc>
1618     This method confirms that the bind was successful.
1619   </doc>
1620       <chassis name="client" implement="MUST"/>
1621     </method>
1622
1623     <!-- Unofficial additions to the 0-8 protocol, lifted from the 0-9
1624          protocol specification: queue.unbind, queue.unbind-ok -->
1625
1626     <method name = "unbind" synchronous = "1" index = "50" label = "unbind a queue from an exchange">
1627       <doc>This method unbinds a queue from an exchange.</doc>
1628       <rule name = "01">
1629         <doc>If a unbind fails, the server MUST raise a connection exception.</doc>
1630       </rule>
1631       <chassis name="server" implement="MUST"/>
1632       <response name="unbind-ok"/>
1633
1634       <field name = "ticket" domain = "access ticket">
1635         <doc>
1636           The client provides a valid access ticket giving "active"
1637           access rights to the queue's access realm.
1638         </doc>
1639       </field>
1640
1641       <field name = "queue" domain = "queue name">
1642         <doc>Specifies the name of the queue to unbind.</doc>
1643         <rule name = "02">
1644           <doc>
1645             If the queue does not exist the server MUST raise a channel exception
1646             with reply code 404 (not found).
1647           </doc>
1648         </rule>
1649       </field>
1650
1651       <field name = "exchange" domain = "exchange name">
1652         <doc>The name of the exchange to unbind from.</doc>
1653         <rule name = "03">
1654           <doc>
1655             If the exchange does not exist the server MUST raise a channel
1656             exception with reply code 404 (not found).
1657           </doc>
1658         </rule>
1659       </field>
1660
1661       <field name = "routing key" domain = "shortstr" label = "routing key of binding">
1662         <doc>Specifies the routing key of the binding to unbind.</doc>
1663       </field>
1664
1665       <field name = "arguments" domain = "table" label = "arguments of binding">
1666         <doc>Specifies the arguments of the binding to unbind.</doc>
1667       </field>
1668     </method>
1669
1670     <method name = "unbind-ok" synchronous = "1" index = "51" label = "confirm unbind successful">
1671       <doc>This method confirms that the unbind was successful.</doc>
1672       <chassis name = "client" implement = "MUST"/>
1673     </method>
1674
1675     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1676     <method name="purge" synchronous="1" index="30">
1677   purge a queue
1678   <doc>
1679     This method removes all messages from a queue.  It does not cancel
1680     consumers.  Purged messages are deleted without any formal "undo"
1681     mechanism.
1682   </doc>
1683       <rule implement="MUST">
1684         <test>amq_queue_15</test>
1685     A call to purge MUST result in an empty queue.
1686   </rule>
1687       <rule implement="MUST">
1688         <test>amq_queue_41</test>
1689     On transacted channels the server MUST not purge messages that have
1690     already been sent to a client but not yet acknowledged.
1691   </rule>
1692       <rule implement="MAY">
1693         <test>amq_queue_42</test>
1694     The server MAY implement a purge queue or log that allows system
1695     administrators to recover accidentally-purged messages.  The server
1696     SHOULD NOT keep purged messages in the same storage spaces as the
1697     live messages since the volumes of purged messages may get very
1698     large.
1699   </rule>
1700       <chassis name="server" implement="MUST"/>
1701       <response name="purge-ok"/>
1702       <field name="ticket" domain="access ticket">
1703         <doc>
1704       The access ticket must be for the access realm that holds the
1705       queue.
1706     </doc>
1707         <rule implement="MUST">
1708       The client MUST provide a valid access ticket giving "read" access
1709       rights to the queue's access realm.  Note that purging a queue is
1710       equivalent to reading all messages and discarding them.
1711     </rule>
1712       </field>
1713   <field name = "queue" domain = "queue name">
1714     <doc>
1715       Specifies the name of the queue to purge.  If the queue name is
1716       empty, refers to the current queue for the channel, which is
1717       the last declared queue.
1718     </doc>
1719     <doc name = "rule">
1720       If the client did not previously declare a queue, and the queue
1721       name in this method is empty, the server MUST raise a connection
1722       exception with reply code 530 (not allowed).
1723     </doc>
1724     <doc name = "rule" test = "amq_queue_16">
1725       The queue must exist. Attempting to purge a non-existing queue
1726       causes a channel exception.
1727     </doc>
1728   </field>
1729
1730   <field name = "nowait" type = "bit">
1731     do not send a reply method
1732     <doc>
1733     If set, the server will not respond to the method. The client should
1734     not wait for a reply method.  If the server could not complete the
1735     method it will raise a channel or connection exception.
1736     </doc>
1737   </field>
1738     </method>
1739     <method name="purge-ok" synchronous="1" index="31">
1740   confirms a queue purge
1741   <doc>
1742     This method confirms the purge of a queue.
1743   </doc>
1744       <chassis name="client" implement="MUST"/>
1745       <field name="message count" type="long">
1746     number of messages purged
1747     <doc>
1748       Reports the number of messages purged.
1749     </doc>
1750       </field>
1751     </method>
1752     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1753     <method name="delete" synchronous="1" index="40">
1754   delete a queue
1755   <doc>
1756     This method deletes a queue.  When a queue is deleted any pending
1757     messages are sent to a dead-letter queue if this is defined in the
1758     server configuration, and all consumers on the queue are cancelled.
1759   </doc>
1760       <rule implement="SHOULD">
1761         <test>amq_queue_43</test>
1762     The server SHOULD use a dead-letter queue to hold messages that
1763     were pending on a deleted queue, and MAY provide facilities for
1764     a system administrator to move these messages back to an active
1765     queue.
1766   </rule>
1767       <chassis name="server" implement="MUST"/>
1768       <response name="delete-ok"/>
1769       <field name="ticket" domain="access ticket">
1770         <doc>
1771       The client provides a valid access ticket giving "active"
1772       access rights to the queue's access realm.
1773     </doc>
1774       </field>
1775
1776   <field name = "queue" domain = "queue name">
1777     <doc>
1778       Specifies the name of the queue to delete. If the queue name is
1779       empty, refers to the current queue for the channel, which is the
1780       last declared queue.
1781     </doc>
1782     <doc name = "rule">
1783       If the client did not previously declare a queue, and the queue
1784       name in this method is empty, the server MUST raise a connection
1785       exception with reply code 530 (not allowed).
1786     </doc>
1787     <doc name = "rule" test = "amq_queue_21">
1788       The queue must exist. Attempting to delete a non-existing queue
1789       causes a channel exception.
1790     </doc>
1791   </field>
1792
1793       <field name="if unused" type="bit">
1794     delete only if unused
1795     <doc>
1796       If set, the server will only delete the queue if it has no
1797       consumers. If the queue has consumers the server does does not
1798       delete it but raises a channel exception instead.
1799     </doc>
1800         <rule implement="MUST">
1801           <test>amq_queue_29</test>
1802           <test>amq_queue_30</test>
1803       The server MUST respect the if-unused flag when deleting a queue.
1804     </rule>
1805       </field>
1806       <field name="if empty" type="bit">
1807     delete only if empty
1808         <test>amq_queue_27</test>
1809         <doc>
1810       If set, the server will only delete the queue if it has no
1811       messages. If the queue is not empty the server raises a channel
1812       exception.
1813     </doc>
1814       </field>
1815   <field name = "nowait" type = "bit">
1816     do not send a reply method
1817     <doc>
1818     If set, the server will not respond to the method. The client should
1819     not wait for a reply method.  If the server could not complete the
1820     method it will raise a channel or connection exception.
1821     </doc>
1822   </field>
1823     </method>
1824
1825     <method name="delete-ok" synchronous="1" index="41">
1826   confirm deletion of a queue
1827   <doc>
1828     This method confirms the deletion of a queue.
1829   </doc>
1830       <chassis name="client" implement="MUST"/>
1831       <field name="message count" type="long">
1832     number of messages purged
1833     <doc>
1834       Reports the number of messages purged.
1835     </doc>
1836       </field>
1837     </method>
1838   </class>
1839   <class name="basic" handler="channel" index="60">
1840     <!--
1841 ======================================================
1842 ==       BASIC MIDDLEWARE
1843 ======================================================
1844 -->
1845   work with basic content
1846 <doc>
1847   The Basic class provides methods that support an industry-standard
1848   messaging model.
1849 </doc>
1850
1851 <doc name = "grammar">
1852     basic               = C:QOS S:QOS-OK
1853                         / C:CONSUME S:CONSUME-OK
1854                         / C:CANCEL S:CANCEL-OK
1855                         / C:PUBLISH content
1856                         / S:RETURN content
1857                         / S:DELIVER content
1858                         / C:GET ( S:GET-OK content / S:GET-EMPTY )
1859                         / C:ACK
1860                         / C:REJECT
1861 </doc>
1862
1863 <chassis name = "server" implement = "MUST" />
1864 <chassis name = "client" implement = "MAY"  />
1865
1866 <doc name = "rule" test = "amq_basic_08">
1867   The server SHOULD respect the persistent property of basic messages
1868   and SHOULD make a best-effort to hold persistent basic messages on a
1869   reliable storage mechanism.
1870 </doc>
1871 <doc name = "rule" test = "amq_basic_09">
1872   The server MUST NOT discard a persistent basic message in case of a
1873   queue overflow. The server MAY use the Channel.Flow method to slow
1874   or stop a basic message publisher when necessary.
1875 </doc>
1876 <doc name = "rule" test = "amq_basic_10">
1877   The server MAY overflow non-persistent basic messages to persistent
1878   storage and MAY discard or dead-letter non-persistent basic messages
1879   on a priority basis if the queue size exceeds some configured limit.
1880 </doc>
1881 <doc name = "rule" test = "amq_basic_11">
1882   The server MUST implement at least 2 priority levels for basic
1883   messages, where priorities 0-4 and 5-9 are treated as two distinct
1884   levels. The server MAY implement up to 10 priority levels.
1885 </doc>
1886 <doc name = "rule" test = "amq_basic_12">
1887   The server MUST deliver messages of the same priority in order
1888   irrespective of their individual persistence.
1889 </doc>
1890 <doc name = "rule" test = "amq_basic_13">
1891   The server MUST support both automatic and explicit acknowledgements
1892   on Basic content.
1893 </doc>
1894
1895 <!--  These are the properties for a Basic content  -->
1896
1897 <field name = "content type" type = "shortstr">
1898     MIME content type
1899 </field>
1900 <field name = "content encoding" type = "shortstr">
1901     MIME content encoding
1902 </field>
1903 <field name = "headers" type = "table">
1904     Message header field table
1905 </field>
1906 <field name = "delivery mode" type = "octet">
1907     Non-persistent (1) or persistent (2)
1908 </field>
1909 <field name = "priority" type = "octet">
1910     The message priority, 0 to 9
1911 </field>
1912 <field name = "correlation id" type = "shortstr">
1913     The application correlation identifier
1914 </field>
1915 <field name = "reply to" type = "shortstr">
1916     The destination to reply to
1917 </field>
1918 <field name = "expiration" type = "shortstr">
1919     Message expiration specification
1920 </field>
1921 <field name = "message id" type = "shortstr">
1922     The application message identifier
1923 </field>
1924 <field name = "timestamp" type = "timestamp">
1925     The message timestamp
1926 </field>
1927 <field name = "type" type = "shortstr">
1928     The message type name
1929 </field>
1930 <field name = "user id" type = "shortstr">
1931     The creating user id
1932 </field>
1933 <field name = "app id" type = "shortstr">
1934     The creating application id
1935 </field>
1936 <field name = "cluster id" type = "shortstr">
1937     Intra-cluster routing identifier
1938 </field>
1939
1940
1941 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1942
1943 <method name = "qos" synchronous = "1" index = "10">
1944   specify quality of service
1945   <doc>
1946     This method requests a specific quality of service.  The QoS can
1947     be specified for the current channel or for all channels on the
1948     connection.  The particular properties and semantics of a qos method
1949     always depend on the content class semantics.  Though the qos method
1950     could in principle apply to both peers, it is currently meaningful
1951     only for the server.
1952   </doc>
1953   <chassis name = "server" implement = "MUST" />
1954   <response name = "qos-ok" />
1955
1956   <field name = "prefetch size" type = "long">
1957     prefetch window in octets
1958     <doc>
1959       The client can request that messages be sent in advance so that
1960       when the client finishes processing a message, the following
1961       message is already held locally, rather than needing to be sent
1962       down the channel.  Prefetching gives a performance improvement.
1963       This field specifies the prefetch window size in octets.  The
1964       server will send a message in advance if it is equal to or
1965       smaller in size than the available prefetch size (and also falls
1966       into other prefetch limits). May be set to zero, meaning "no
1967       specific limit", although other prefetch limits may still apply.
1968       The prefetch-size is ignored if the no-ack option is set.
1969     </doc>
1970     <doc name = "rule" test = "amq_basic_17">
1971       The server MUST ignore this setting when the client is not
1972       processing any messages - i.e. the prefetch size does not limit
1973       the transfer of single messages to a client, only the sending in
1974       advance of more messages while the client still has one or more
1975       unacknowledged messages.
1976    </doc>
1977   </field>
1978
1979   <field name = "prefetch count" type = "short">
1980     prefetch window in messages
1981     <doc>
1982       Specifies a prefetch window in terms of whole messages.  This
1983       field may be used in combination with the prefetch-size field;
1984       a message will only be sent in advance if both prefetch windows
1985       (and those at the channel and connection level) allow it.
1986       The prefetch-count is ignored if the no-ack option is set.
1987     </doc>
1988     <doc name = "rule" test = "amq_basic_18">
1989       The server MAY send less data in advance than allowed by the
1990       client's specified prefetch windows but it MUST NOT send more.
1991     </doc>
1992   </field>
1993
1994   <field name = "global" type = "bit">
1995     apply to entire connection
1996     <doc>
1997       By default the QoS settings apply to the current channel only.  If
1998       this field is set, they are applied to the entire connection.
1999     </doc>
2000   </field>
2001 </method>
2002
2003 <method name = "qos-ok" synchronous = "1" index = "11">
2004   confirm the requested qos
2005   <doc>
2006     This method tells the client that the requested QoS levels could
2007     be handled by the server.  The requested QoS applies to all active
2008     consumers until a new QoS is defined.
2009   </doc>
2010   <chassis name = "client" implement = "MUST" />
2011 </method>
2012
2013 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2014
2015 <method name = "consume" synchronous = "1" index = "20">
2016   start a queue consumer
2017   <doc>
2018     This method asks the server to start a "consumer", which is a
2019     transient request for messages from a specific queue. Consumers
2020     last as long as the channel they were created on, or until the
2021     client cancels them.
2022   </doc>
2023   <doc name = "rule" test = "amq_basic_01">
2024     The server SHOULD support at least 16 consumers per queue, unless
2025     the queue was declared as private, and ideally, impose no limit
2026     except as defined by available resources.
2027   </doc>
2028   <chassis name = "server" implement = "MUST" />
2029   <response name = "consume-ok" />
2030
2031   <field name = "ticket" domain = "access ticket">
2032     <doc name = "rule">
2033       The client MUST provide a valid access ticket giving "read" access
2034       rights to the realm for the queue.
2035     </doc>
2036   </field>
2037
2038   <field name = "queue" domain = "queue name">
2039     <doc>
2040       Specifies the name of the queue to consume from.  If the queue name
2041       is null, refers to the current queue for the channel, which is the
2042       last declared queue.
2043     </doc>
2044     <doc name = "rule">
2045       If the client did not previously declare a queue, and the queue name
2046       in this method is empty, the server MUST raise a connection exception
2047       with reply code 530 (not allowed).
2048     </doc>
2049   </field>
2050
2051   <field name = "consumer tag" domain = "consumer tag">
2052     <doc>
2053       Specifies the identifier for the consumer. The consumer tag is
2054       local to a connection, so two clients can use the same consumer
2055       tags. If this field is empty the server will generate a unique
2056       tag.
2057     </doc>
2058     <doc name = "rule" test = "todo">
2059       The tag MUST NOT refer to an existing consumer. If the client
2060       attempts to create two consumers with the same non-empty tag
2061       the server MUST raise a connection exception with reply code
2062       530 (not allowed).
2063     </doc>
2064   </field>
2065
2066   <field name = "no local" domain = "no local" />
2067
2068   <field name = "no ack" domain = "no ack" />
2069
2070   <field name = "exclusive" type = "bit">
2071     request exclusive access
2072     <doc>
2073       Request exclusive consumer access, meaning only this consumer can
2074       access the queue.
2075     </doc>
2076     <doc name = "rule" test = "amq_basic_02">
2077       If the server cannot grant exclusive access to the queue when asked,
2078       - because there are other consumers active - it MUST raise a channel
2079       exception with return code 403 (access refused).
2080     </doc>
2081   </field>
2082
2083   <field name = "nowait" type = "bit">
2084     do not send a reply method
2085     <doc>
2086     If set, the server will not respond to the method. The client should
2087     not wait for a reply method.  If the server could not complete the
2088     method it will raise a channel or connection exception.
2089     </doc>
2090   </field>
2091 </method>
2092
2093 <method name = "consume-ok" synchronous = "1" index = "21">
2094   confirm a new consumer
2095   <doc>
2096     The server provides the client with a consumer tag, which is used
2097     by the client for methods called on the consumer at a later stage.
2098   </doc>
2099   <chassis name = "client" implement = "MUST" />
2100
2101   <field name = "consumer tag" domain = "consumer tag">
2102     <doc>
2103       Holds the consumer tag specified by the client or provided by
2104       the server.
2105     </doc>
2106   </field>
2107 </method>
2108
2109
2110 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2111
2112 <method name = "cancel" synchronous = "1" index = "30">
2113   end a queue consumer
2114   <doc test = "amq_basic_04">
2115     This method cancels a consumer. This does not affect already
2116     delivered messages, but it does mean the server will not send any
2117     more messages for that consumer.  The client may receive an
2118     abitrary number of messages in between sending the cancel method
2119     and receiving the cancel-ok reply.
2120   </doc>
2121   <doc name = "rule" test = "todo">
2122     If the queue no longer exists when the client sends a cancel command,
2123     or the consumer has been cancelled for other reasons, this command
2124     has no effect.
2125   </doc>
2126   <chassis name = "server" implement = "MUST" />
2127   <response name = "cancel-ok" />
2128
2129   <field name = "consumer tag" domain = "consumer tag" />
2130
2131   <field name = "nowait" type = "bit">
2132     do not send a reply method
2133     <doc>
2134     If set, the server will not respond to the method. The client should
2135     not wait for a reply method.  If the server could not complete the
2136     method it will raise a channel or connection exception.
2137     </doc>
2138   </field>
2139 </method>
2140
2141 <method name = "cancel-ok" synchronous = "1" index = "31">
2142   confirm a cancelled consumer
2143   <doc>
2144     This method confirms that the cancellation was completed.
2145   </doc>
2146   <chassis name = "client" implement = "MUST" />
2147
2148   <field name = "consumer tag" domain = "consumer tag" />
2149 </method>
2150
2151
2152 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2153
2154 <method name = "publish" content = "1" index = "40">
2155   publish a message
2156   <doc>
2157     This method publishes a message to a specific exchange. The message
2158     will be routed to queues as defined by the exchange configuration
2159     and distributed to any active consumers when the transaction, if any,
2160     is committed.
2161   </doc>
2162   <chassis name = "server" implement = "MUST" />
2163
2164   <field name = "ticket" domain = "access ticket">
2165     <doc name = "rule">
2166       The client MUST provide a valid access ticket giving "write"
2167       access rights to the access realm for the exchange.
2168     </doc>
2169   </field>
2170
2171   <field name = "exchange" domain = "exchange name">
2172     <doc>
2173       Specifies the name of the exchange to publish to.  The exchange
2174       name can be empty, meaning the default exchange.  If the exchange
2175       name is specified, and that exchange does not exist, the server
2176       will raise a channel exception.
2177     </doc>
2178     <doc name = "rule" test = "amq_basic_06">
2179       The server MUST accept a blank exchange name to mean the default
2180       exchange.
2181     </doc>
2182     <doc name = "rule" test = "amq_basic_14">
2183       If the exchange was declared as an internal exchange, the server
2184       MUST raise a channel exception with a reply code 403 (access
2185       refused).
2186     </doc>
2187     <doc name = "rule" test = "amq_basic_15">
2188       The exchange MAY refuse basic content in which case it MUST raise
2189       a channel exception with reply code 540 (not implemented).
2190     </doc>
2191   </field>
2192
2193   <field name = "routing key" type = "shortstr">
2194      Message routing key
2195     <doc>
2196       Specifies the routing key for the message.  The routing key is
2197       used for routing messages depending on the exchange configuration.
2198     </doc>
2199   </field>
2200
2201   <field name = "mandatory" type = "bit">
2202     indicate mandatory routing
2203     <doc>
2204       This flag tells the server how to react if the message cannot be
2205       routed to a queue.  If this flag is set, the server will return an
2206       unroutable message with a Return method.  If this flag is zero, the
2207       server silently drops the message.
2208     </doc>
2209     <doc name = "rule" test = "amq_basic_07">
2210       The server SHOULD implement the mandatory flag.
2211     </doc>
2212   </field>
2213
2214   <field name = "immediate" type = "bit">
2215     request immediate delivery
2216     <doc>
2217       This flag tells the server how to react if the message cannot be
2218       routed to a queue consumer immediately.  If this flag is set, the
2219       server will return an undeliverable message with a Return method.
2220       If this flag is zero, the server will queue the message, but with
2221       no guarantee that it will ever be consumed.
2222     </doc>
2223     <doc name = "rule" test = "amq_basic_16">
2224       The server SHOULD implement the immediate flag.
2225     </doc>
2226   </field>
2227 </method>
2228
2229 <method name = "return" content = "1" index = "50">
2230   return a failed message
2231   <doc>
2232     This method returns an undeliverable message that was published
2233     with the "immediate" flag set, or an unroutable message published
2234     with the "mandatory" flag set. The reply code and text provide
2235     information about the reason that the message was undeliverable.
2236   </doc>
2237   <chassis name = "client" implement = "MUST" />
2238
2239   <field name = "reply code" domain = "reply code" />
2240   <field name = "reply text" domain = "reply text" />
2241
2242   <field name = "exchange" domain = "exchange name">
2243     <doc>
2244       Specifies the name of the exchange that the message was
2245       originally published to.
2246     </doc>
2247   </field>
2248
2249   <field name = "routing key" type = "shortstr">
2250      Message routing key
2251     <doc>
2252       Specifies the routing key name specified when the message was
2253       published.
2254     </doc>
2255   </field>
2256 </method>
2257
2258
2259 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2260
2261 <method name = "deliver" content = "1" index = "60">
2262   notify the client of a consumer message
2263   <doc>
2264     This method delivers a message to the client, via a consumer.  In
2265     the asynchronous message delivery model, the client starts a
2266     consumer using the Consume method, then the server responds with
2267     Deliver methods as and when messages arrive for that consumer.
2268   </doc>
2269   <doc name = "rule" test = "amq_basic_19">
2270     The server SHOULD track the number of times a message has been
2271     delivered to clients and when a message is redelivered a certain
2272     number of times - e.g. 5 times - without being acknowledged, the
2273     server SHOULD consider the message to be unprocessable (possibly
2274     causing client applications to abort), and move the message to a
2275     dead letter queue.
2276   </doc>
2277   <chassis name = "client" implement = "MUST" />
2278
2279   <field name = "consumer tag" domain = "consumer tag" />
2280
2281   <field name = "delivery tag" domain = "delivery tag" />
2282
2283   <field name = "redelivered" domain = "redelivered" />
2284
2285   <field name = "exchange" domain = "exchange name">
2286     <doc>
2287       Specifies the name of the exchange that the message was
2288       originally published to.
2289     </doc>
2290   </field>
2291
2292   <field name = "routing key" type = "shortstr">
2293      Message routing key
2294     <doc>
2295       Specifies the routing key name specified when the message was
2296       published.
2297     </doc>
2298   </field>
2299 </method>
2300
2301
2302 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2303
2304 <method name = "get" synchronous = "1" index = "70">
2305   direct access to a queue
2306   <doc>
2307     This method provides a direct access to the messages in a queue
2308     using a synchronous dialogue that is designed for specific types of
2309     application where synchronous functionality is more important than
2310     performance.
2311   </doc>
2312   <response name = "get-ok" />
2313   <response name = "get-empty" />
2314   <chassis name = "server" implement = "MUST" />
2315
2316   <field name = "ticket" domain = "access ticket">
2317     <doc name = "rule">
2318       The client MUST provide a valid access ticket giving "read"
2319       access rights to the realm for the queue.
2320     </doc>
2321   </field>
2322
2323   <field name = "queue" domain = "queue name">
2324     <doc>
2325       Specifies the name of the queue to consume from.  If the queue name
2326       is null, refers to the current queue for the channel, which is the
2327       last declared queue.
2328     </doc>
2329     <doc name = "rule">
2330       If the client did not previously declare a queue, and the queue name
2331       in this method is empty, the server MUST raise a connection exception
2332       with reply code 530 (not allowed).
2333     </doc>
2334   </field>
2335
2336   <field name = "no ack" domain = "no ack" />
2337 </method>
2338
2339 <method name = "get-ok" synchronous = "1" content = "1" index = "71">
2340   provide client with a message
2341   <doc>
2342     This method delivers a message to the client following a get
2343     method.  A message delivered by 'get-ok' must be acknowledged
2344     unless the no-ack option was set in the get method.
2345   </doc>
2346   <chassis name = "client" implement = "MAY" />
2347
2348   <field name = "delivery tag" domain = "delivery tag" />
2349
2350   <field name = "redelivered"  domain = "redelivered"  />
2351
2352   <field name = "exchange" domain = "exchange name">
2353     <doc>
2354       Specifies the name of the exchange that the message was originally
2355       published to.  If empty, the message was published to the default
2356       exchange.
2357     </doc>
2358   </field>
2359
2360   <field name = "routing key" type = "shortstr">
2361      Message routing key
2362     <doc>
2363       Specifies the routing key name specified when the message was
2364       published.
2365     </doc>
2366   </field>
2367
2368   <field name = "message count" type = "long" >
2369     number of messages pending
2370     <doc>
2371       This field reports the number of messages pending on the queue,
2372       excluding the message being delivered.  Note that this figure is
2373       indicative, not reliable, and can change arbitrarily as messages
2374       are added to the queue and removed by other clients.
2375     </doc>
2376   </field>
2377 </method>
2378
2379
2380 <method name = "get-empty" synchronous = "1" index = "72">
2381   indicate no messages available
2382   <doc>
2383     This method tells the client that the queue has no messages
2384     available for the client.
2385   </doc>
2386   <chassis name = "client" implement = "MAY" />
2387
2388   <field name = "cluster id" type = "shortstr">
2389      Cluster id
2390     <doc>
2391       For use by cluster applications, should not be used by
2392       client applications.
2393     </doc>
2394   </field>
2395 </method>
2396
2397 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2398
2399 <method name = "ack" index = "80">
2400   acknowledge one or more messages
2401   <doc>
2402     This method acknowledges one or more messages delivered via the
2403     Deliver or Get-Ok methods.  The client can ask to confirm a
2404     single message or a set of messages up to and including a specific
2405     message.
2406   </doc>
2407   <chassis name = "server" implement = "MUST" />
2408   <field name = "delivery tag" domain = "delivery tag" />
2409
2410   <field name = "multiple" type = "bit">
2411     acknowledge multiple messages
2412     <doc>
2413       If set to 1, the delivery tag is treated as "up to and including",
2414       so that the client can acknowledge multiple messages with a single
2415       method.  If set to zero, the delivery tag refers to a single
2416       message.  If the multiple field is 1, and the delivery tag is zero,
2417       tells the server to acknowledge all outstanding mesages.
2418     </doc>
2419     <doc name = "rule" test = "amq_basic_20">
2420       The server MUST validate that a non-zero delivery-tag refers to an
2421       delivered message, and raise a channel exception if this is not the
2422       case.
2423     </doc>
2424   </field>
2425 </method>
2426
2427 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2428
2429 <method name = "reject" index = "90">
2430   reject an incoming message
2431   <doc>
2432     This method allows a client to reject a message.  It can be used to
2433     interrupt and cancel large incoming messages, or return untreatable
2434     messages to their original queue.
2435   </doc>
2436   <doc name = "rule" test = "amq_basic_21">
2437     The server SHOULD be capable of accepting and process the Reject
2438     method while sending message content with a Deliver or Get-Ok
2439     method.  I.e. the server should read and process incoming methods
2440     while sending output frames.  To cancel a partially-send content,
2441     the server sends a content body frame of size 1 (i.e. with no data
2442     except the frame-end octet).
2443   </doc>
2444   <doc name = "rule" test = "amq_basic_22">
2445     The server SHOULD interpret this method as meaning that the client
2446     is unable to process the message at this time.
2447   </doc>
2448   <doc name = "rule">
2449     A client MUST NOT use this method as a means of selecting messages
2450     to process.  A rejected message MAY be discarded or dead-lettered,
2451     not necessarily passed to another client.
2452   </doc>      
2453   <chassis name = "server" implement = "MUST" />
2454     
2455   <field name = "delivery tag" domain = "delivery tag" />
2456
2457   <field name = "requeue" type = "bit">
2458     requeue the message
2459     <doc>
2460       If this field is zero, the message will be discarded.  If this bit
2461       is 1, the server will attempt to requeue the message.
2462     </doc>
2463     <doc name = "rule" test = "amq_basic_23">
2464       The server MUST NOT deliver the message to the same client within
2465       the context of the current channel.  The recommended strategy is
2466       to attempt to deliver the message to an alternative consumer, and
2467       if that is not possible, to move the message to a dead-letter
2468       queue.  The server MAY use more sophisticated tracking to hold
2469       the message on the queue and redeliver it to the same client at
2470       a later stage.
2471     </doc>
2472   </field>
2473 </method>
2474
2475 <method name = "recover" index = "100">
2476   redeliver unacknowledged messages. This method is only allowed on non-transacted channels.
2477   <doc>
2478     This method asks the broker to redeliver all unacknowledged messages on a
2479     specifieid channel. Zero or more messages may be redelivered.
2480   </doc>
2481   <chassis name = "server" implement = "MUST" />
2482
2483   <field name = "requeue" type = "bit">
2484     requeue the message
2485     <doc>
2486       If this field is zero, the message will be redelivered to the original recipient.  If this bit
2487       is 1, the server will attempt to requeue the message, potentially then delivering it to an
2488       alternative subscriber.
2489     </doc>
2490   </field>
2491
2492     <doc name="rule">
2493       The server MUST set the redelivered flag on all messages that are resent.
2494     </doc>
2495     <doc name="rule">
2496     The server MUST raise a channel exception if this is called on a transacted channel.
2497     </doc>
2498 </method>
2499
2500
2501 </class>
2502
2503
2504   <class name="file" handler="channel" index="70">
2505     <!--
2506 ======================================================
2507 ==      FILE TRANSFER
2508 ======================================================
2509 -->
2510   work with file content
2511 <doc>
2512   The file class provides methods that support reliable file transfer.
2513   File messages have a specific set of properties that are required for
2514   interoperability with file transfer applications. File messages and
2515   acknowledgements are subject to channel transactions.  Note that the
2516   file class does not provide message browsing methods; these are not
2517   compatible with the staging model.  Applications that need browsable
2518   file transfer should use Basic content and the Basic class.
2519 </doc>
2520
2521 <doc name = "grammar">
2522     file                = C:QOS S:QOS-OK
2523                         / C:CONSUME S:CONSUME-OK
2524                         / C:CANCEL S:CANCEL-OK
2525                         / C:OPEN S:OPEN-OK C:STAGE content
2526                         / S:OPEN C:OPEN-OK S:STAGE content
2527                         / C:PUBLISH
2528                         / S:DELIVER
2529                         / S:RETURN
2530                         / C:ACK
2531                         / C:REJECT
2532 </doc>
2533
2534 <chassis name = "server" implement = "MAY" />
2535 <chassis name = "client" implement = "MAY" />
2536
2537 <doc name = "rule">
2538   The server MUST make a best-effort to hold file messages on a
2539   reliable storage mechanism.
2540 </doc>
2541 <doc name = "rule">
2542   The server MUST NOT discard a file message in case of a queue
2543   overflow. The server MUST use the Channel.Flow method to slow or stop
2544   a file message publisher when necessary.
2545 </doc>
2546 <doc name = "rule">
2547   The server MUST implement at least 2 priority levels for file
2548   messages, where priorities 0-4 and 5-9 are treated as two distinct
2549   levels. The server MAY implement up to 10 priority levels.
2550 </doc>
2551 <doc name = "rule">
2552   The server MUST support both automatic and explicit acknowledgements
2553   on file content.
2554 </doc>
2555
2556 <!--  These are the properties for a File content  -->
2557
2558 <field name = "content type" type = "shortstr">
2559     MIME content type
2560 </field>
2561 <field name = "content encoding" type = "shortstr">
2562     MIME content encoding
2563 </field>
2564 <field name = "headers" type = "table">
2565     Message header field table
2566 </field>
2567 <field name = "priority" type = "octet">
2568     The message priority, 0 to 9
2569 </field>
2570 <field name = "reply to" type = "shortstr">
2571     The destination to reply to
2572 </field>
2573 <field name = "message id" type = "shortstr">
2574     The application message identifier
2575 </field>
2576 <field name = "filename" type = "shortstr">
2577     The message filename
2578 </field>
2579 <field name = "timestamp" type = "timestamp">
2580     The message timestamp
2581 </field>
2582 <field name = "cluster id" type = "shortstr">
2583     Intra-cluster routing identifier
2584 </field>
2585
2586
2587 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2588
2589 <method name = "qos" synchronous = "1" index = "10">
2590   specify quality of service
2591   <doc>
2592     This method requests a specific quality of service.  The QoS can
2593     be specified for the current channel or for all channels on the
2594     connection.  The particular properties and semantics of a qos method
2595     always depend on the content class semantics.  Though the qos method
2596     could in principle apply to both peers, it is currently meaningful
2597     only for the server.
2598   </doc>
2599   <chassis name = "server" implement = "MUST" />
2600   <response name = "qos-ok" />
2601
2602   <field name = "prefetch size" type = "long">
2603     prefetch window in octets
2604     <doc>
2605       The client can request that messages be sent in advance so that
2606       when the client finishes processing a message, the following
2607       message is already held locally, rather than needing to be sent
2608       down the channel.  Prefetching gives a performance improvement.
2609       This field specifies the prefetch window size in octets. May be
2610       set to zero, meaning "no specific limit".  Note that other
2611       prefetch limits may still apply. The prefetch-size is ignored
2612       if the no-ack option is set.
2613     </doc>
2614   </field>
2615
2616   <field name = "prefetch count" type = "short">
2617     prefetch window in messages
2618     <doc>
2619       Specifies a prefetch window in terms of whole messages.  This
2620       is compatible with some file API implementations.  This field
2621       may be used in combination with the prefetch-size field; a
2622       message will only be sent in advance if both prefetch windows
2623       (and those at the channel and connection level) allow it.
2624       The prefetch-count is ignored if the no-ack option is set.
2625     </doc>
2626     <doc name = "rule">
2627       The server MAY send less data in advance than allowed by the
2628       client's specified prefetch windows but it MUST NOT send more.
2629     </doc>
2630   </field>
2631
2632   <field name = "global" type = "bit">
2633     apply to entire connection
2634     <doc>
2635       By default the QoS settings apply to the current channel only.  If
2636       this field is set, they are applied to the entire connection.
2637     </doc>
2638   </field>
2639 </method>
2640
2641 <method name = "qos-ok" synchronous = "1" index = "11">
2642   confirm the requested qos
2643   <doc>
2644     This method tells the client that the requested QoS levels could
2645     be handled by the server.  The requested QoS applies to all active
2646     consumers until a new QoS is defined.
2647   </doc>
2648   <chassis name = "client" implement = "MUST" />
2649 </method>
2650
2651 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2652
2653 <method name = "consume" synchronous = "1" index = "20">
2654   start a queue consumer
2655   <doc>
2656     This method asks the server to start a "consumer", which is a
2657     transient request for messages from a specific queue. Consumers
2658     last as long as the channel they were created on, or until the
2659     client cancels them.
2660   </doc>
2661   <doc name = "rule">
2662     The server SHOULD support at least 16 consumers per queue, unless
2663     the queue was declared as private, and ideally, impose no limit
2664     except as defined by available resources.
2665   </doc>
2666   <chassis name = "server" implement = "MUST" />
2667   <response name = "consume-ok" />
2668
2669   <field name = "ticket" domain = "access ticket">
2670     <doc name = "rule">
2671       The client MUST provide a valid access ticket giving "read" access
2672       rights to the realm for the queue.
2673     </doc>
2674   </field>
2675
2676   <field name = "queue" domain = "queue name">
2677     <doc>
2678       Specifies the name of the queue to consume from.  If the queue name
2679       is null, refers to the current queue for the channel, which is the
2680       last declared queue.
2681     </doc>
2682     <doc name = "rule">
2683       If the client did not previously declare a queue, and the queue name
2684       in this method is empty, the server MUST raise a connection exception
2685       with reply code 530 (not allowed).
2686     </doc>
2687   </field>
2688
2689   <field name = "consumer tag" domain = "consumer tag">
2690     <doc>
2691       Specifies the identifier for the consumer. The consumer tag is
2692       local to a connection, so two clients can use the same consumer
2693       tags. If this field is empty the server will generate a unique
2694       tag.
2695     </doc>
2696     <doc name = "rule" test = "todo">
2697       The tag MUST NOT refer to an existing consumer. If the client
2698       attempts to create two consumers with the same non-empty tag
2699       the server MUST raise a connection exception with reply code
2700       530 (not allowed).
2701     </doc>
2702   </field>
2703
2704   <field name = "no local" domain = "no local" />
2705
2706   <field name = "no ack" domain = "no ack" />
2707
2708   <field name = "exclusive" type = "bit">
2709     request exclusive access
2710     <doc>
2711       Request exclusive consumer access, meaning only this consumer can
2712       access the queue.
2713     </doc>
2714     <doc name = "rule" test = "amq_file_00">
2715       If the server cannot grant exclusive access to the queue when asked,
2716       - because there are other consumers active - it MUST raise a channel
2717       exception with return code 405 (resource locked).
2718     </doc>
2719   </field>
2720
2721   <field name = "nowait" type = "bit">
2722     do not send a reply method
2723     <doc>
2724     If set, the server will not respond to the method. The client should
2725     not wait for a reply method.  If the server could not complete the
2726     method it will raise a channel or connection exception.
2727     </doc>
2728   </field>
2729 </method>
2730
2731 <method name = "consume-ok" synchronous = "1" index = "21">
2732   confirm a new consumer
2733   <doc>
2734     This method provides the client with a consumer tag which it MUST
2735     use in methods that work with the consumer.
2736   </doc>
2737   <chassis name = "client" implement = "MUST" />
2738
2739   <field name = "consumer tag" domain = "consumer tag">
2740     <doc>
2741       Holds the consumer tag specified by the client or provided by
2742       the server.
2743     </doc>
2744   </field>
2745 </method>
2746
2747
2748 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2749
2750 <method name = "cancel" synchronous = "1" index = "30">
2751   end a queue consumer
2752   <doc>
2753     This method cancels a consumer. This does not affect already
2754     delivered messages, but it does mean the server will not send any
2755     more messages for that consumer.
2756   </doc>
2757   <chassis name = "server" implement = "MUST" />
2758   <response name = "cancel-ok" />
2759
2760   <field name = "consumer tag" domain = "consumer tag" />
2761
2762   <field name = "nowait" type = "bit">
2763     do not send a reply method
2764     <doc>
2765     If set, the server will not respond to the method. The client should
2766     not wait for a reply method.  If the server could not complete the
2767     method it will raise a channel or connection exception.
2768     </doc>
2769   </field>
2770 </method>
2771
2772 <method name = "cancel-ok" synchronous = "1" index = "31">
2773   confirm a cancelled consumer
2774   <doc>
2775     This method confirms that the cancellation was completed.
2776   </doc>
2777   <chassis name = "client" implement = "MUST" />
2778
2779   <field name = "consumer tag" domain = "consumer tag" />
2780 </method>
2781
2782
2783 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2784
2785 <method name = "open" synchronous = "1" index = "40">
2786   request to start staging
2787   <doc>
2788     This method requests permission to start staging a message.  Staging
2789     means sending the message into a temporary area at the recipient end
2790     and then delivering the message by referring to this temporary area.
2791     Staging is how the protocol handles partial file transfers - if a
2792     message is partially staged and the connection breaks, the next time
2793     the sender starts to stage it, it can restart from where it left off.
2794   </doc>
2795   <response name = "open-ok" />
2796   <chassis name = "server" implement = "MUST" />
2797   <chassis name = "client" implement = "MUST" />
2798   
2799   <field name = "identifier" type = "shortstr">
2800     staging identifier
2801     <doc>
2802       This is the staging identifier. This is an arbitrary string chosen
2803       by the sender.  For staging to work correctly the sender must use
2804       the same staging identifier when staging the same message a second
2805       time after recovery from a failure.  A good choice for the staging
2806       identifier would be the SHA1 hash of the message properties data
2807       (including the original filename, revised time, etc.).
2808     </doc>
2809   </field>
2810
2811   <field name = "content size" type = "longlong">
2812     message content size
2813     <doc>
2814       The size of the content in octets.  The recipient may use this
2815       information to allocate or check available space in advance, to
2816       avoid "disk full" errors during staging of very large messages.
2817     </doc>
2818     <doc name = "rule">
2819       The sender MUST accurately fill the content-size field.
2820       Zero-length content is permitted.
2821     </doc>
2822   </field>
2823 </method>
2824
2825 <method name = "open-ok" synchronous = "1" index = "41">
2826   confirm staging ready
2827   <doc>
2828     This method confirms that the recipient is ready to accept staged
2829     data.  If the message was already partially-staged at a previous
2830     time the recipient will report the number of octets already staged.
2831   </doc>
2832   <response name = "stage" />
2833   <chassis name = "server" implement = "MUST" />
2834   <chassis name = "client" implement = "MUST" />
2835   
2836   <field name = "staged size" type = "longlong">
2837     already staged amount
2838     <doc>
2839       The amount of previously-staged content in octets.  For a new
2840       message this will be zero.
2841     </doc>
2842     <doc name = "rule">
2843       The sender MUST start sending data from this octet offset in the
2844       message, counting from zero.
2845     </doc>
2846     <doc name = "rule">
2847       The recipient MAY decide how long to hold partially-staged content
2848       and MAY implement staging by always discarding partially-staged
2849       content.  However if it uses the file content type it MUST support
2850       the staging methods.
2851     </doc>
2852   </field>
2853 </method>
2854
2855 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2856
2857 <method name = "stage" content = "1" index = "50">
2858   stage message content
2859   <doc>
2860     This method stages the message, sending the message content to the
2861     recipient from the octet offset specified in the Open-Ok method.
2862   </doc>
2863   <chassis name = "server" implement = "MUST" />
2864   <chassis name = "client" implement = "MUST" />
2865 </method>
2866
2867
2868 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2869
2870 <method name = "publish" index = "60">
2871   publish a message
2872   <doc>
2873     This method publishes a staged file message to a specific exchange.
2874     The file message will be routed to queues as defined by the exchange
2875     configuration and distributed to any active consumers when the
2876     transaction, if any, is committed.
2877   </doc>
2878   <chassis name = "server" implement = "MUST" />
2879
2880   <field name = "ticket" domain = "access ticket">
2881     <doc name = "rule">
2882       The client MUST provide a valid access ticket giving "write"
2883       access rights to the access realm for the exchange.
2884     </doc>
2885   </field>
2886
2887   <field name = "exchange" domain = "exchange name">
2888     <doc>
2889       Specifies the name of the exchange to publish to.  The exchange
2890       name can be empty, meaning the default exchange.  If the exchange
2891       name is specified, and that exchange does not exist, the server
2892       will raise a channel exception.
2893     </doc>
2894     <doc name = "rule">
2895       The server MUST accept a blank exchange name to mean the default
2896       exchange.
2897     </doc>
2898     <doc name = "rule">
2899       If the exchange was declared as an internal exchange, the server
2900       MUST respond with a reply code 403 (access refused) and raise a
2901       channel exception.
2902     </doc>
2903     <doc name = "rule">
2904       The exchange MAY refuse file content in which case it MUST respond
2905       with a reply code 540 (not implemented) and raise a channel
2906       exception.
2907     </doc>
2908   </field>
2909
2910   <field name = "routing key" type = "shortstr">
2911      Message routing key
2912     <doc>
2913       Specifies the routing key for the message.  The routing key is
2914       used for routing messages depending on the exchange configuration.
2915     </doc>
2916   </field>
2917
2918   <field name = "mandatory" type = "bit">
2919     indicate mandatory routing
2920     <doc>
2921       This flag tells the server how to react if the message cannot be
2922       routed to a queue.  If this flag is set, the server will return an
2923       unroutable message with a Return method.  If this flag is zero, the
2924       server silently drops the message.
2925     </doc>
2926     <doc name = "rule" test = "amq_file_00">
2927       The server SHOULD implement the mandatory flag.
2928     </doc>
2929   </field>
2930
2931   <field name = "immediate" type = "bit">
2932     request immediate delivery
2933     <doc>
2934       This flag tells the server how to react if the message cannot be
2935       routed to a queue consumer immediately.  If this flag is set, the
2936       server will return an undeliverable message with a Return method.
2937       If this flag is zero, the server will queue the message, but with
2938       no guarantee that it will ever be consumed.
2939     </doc>
2940     <doc name = "rule" test = "amq_file_00">
2941       The server SHOULD implement the immediate flag.
2942     </doc>
2943   </field>
2944
2945   <field name = "identifier" type = "shortstr">
2946     staging identifier
2947     <doc>
2948       This is the staging identifier of the message to publish.  The
2949       message must have been staged.  Note that a client can send the
2950       Publish method asynchronously without waiting for staging to
2951       finish.
2952     </doc>
2953   </field>
2954 </method>
2955
2956 <method name = "return" content = "1" index = "70">
2957   return a failed message
2958   <doc>
2959     This method returns an undeliverable message that was published
2960     with the "immediate" flag set, or an unroutable message published
2961     with the "mandatory" flag set. The reply code and text provide
2962     information about the reason that the message was undeliverable.
2963   </doc>
2964   <chassis name = "client" implement = "MUST" />
2965
2966   <field name = "reply code" domain = "reply code" />
2967   <field name = "reply text" domain = "reply text" />
2968
2969   <field name = "exchange" domain = "exchange name">
2970     <doc>
2971       Specifies the name of the exchange that the message was
2972       originally published to.
2973     </doc>
2974   </field>
2975
2976   <field name = "routing key" type = "shortstr">
2977      Message routing key
2978     <doc>
2979       Specifies the routing key name specified when the message was
2980       published.
2981     </doc>
2982   </field>
2983 </method>
2984
2985
2986 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
2987
2988 <method name = "deliver" index = "80">
2989   notify the client of a consumer message
2990   <doc>
2991     This method delivers a staged file message to the client, via a
2992     consumer. In the asynchronous message delivery model, the client
2993     starts a consumer using the Consume method, then the server
2994     responds with Deliver methods as and when messages arrive for
2995     that consumer.
2996   </doc>
2997   <doc name = "rule">
2998     The server SHOULD track the number of times a message has been
2999     delivered to clients and when a message is redelivered a certain
3000     number of times - e.g. 5 times - without being acknowledged, the
3001     server SHOULD consider the message to be unprocessable (possibly
3002     causing client applications to abort), and move the message to a
3003     dead letter queue.
3004   </doc>
3005   <chassis name = "client" implement = "MUST" />
3006
3007   <field name = "consumer tag" domain = "consumer tag" />
3008
3009   <field name = "delivery tag" domain = "delivery tag" />
3010
3011   <field name = "redelivered" domain = "redelivered" />
3012
3013   <field name = "exchange" domain = "exchange name">
3014     <doc>
3015       Specifies the name of the exchange that the message was originally
3016       published to.
3017     </doc>
3018   </field>
3019
3020   <field name = "routing key" type = "shortstr">
3021      Message routing key
3022     <doc>
3023       Specifies the routing key name specified when the message was
3024       published.
3025     </doc>
3026   </field>
3027
3028   <field name = "identifier" type = "shortstr">
3029     staging identifier
3030     <doc>
3031       This is the staging identifier of the message to deliver.  The
3032       message must have been staged.  Note that a server can send the
3033       Deliver method asynchronously without waiting for staging to
3034       finish.
3035     </doc>
3036   </field>
3037 </method>
3038
3039
3040 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3041
3042 <method name = "ack" index = "90">
3043   acknowledge one or more messages
3044   <doc>
3045     This method acknowledges one or more messages delivered via the
3046     Deliver method.  The client can ask to confirm a single message or
3047     a set of messages up to and including a specific message.
3048   </doc>
3049   <chassis name = "server" implement = "MUST" />
3050   <field name = "delivery tag" domain = "delivery tag" />
3051       
3052   <field name = "multiple" type = "bit">
3053     acknowledge multiple messages
3054     <doc>
3055       If set to 1, the delivery tag is treated as "up to and including",
3056       so that the client can acknowledge multiple messages with a single
3057       method.  If set to zero, the delivery tag refers to a single
3058       message.  If the multiple field is 1, and the delivery tag is zero,
3059       tells the server to acknowledge all outstanding mesages.
3060     </doc>
3061     <doc name = "rule">
3062       The server MUST validate that a non-zero delivery-tag refers to an
3063       delivered message, and raise a channel exception if this is not the
3064       case.
3065     </doc>
3066   </field>
3067 </method>
3068
3069
3070 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3071
3072 <method name = "reject" index = "100">
3073   reject an incoming message
3074   <doc>
3075     This method allows a client to reject a message.  It can be used to
3076     return untreatable messages to their original queue.  Note that file
3077     content is staged before delivery, so the client will not use this
3078     method to interrupt delivery of a large message.
3079   </doc>
3080   <doc name = "rule">
3081     The server SHOULD interpret this method as meaning that the client
3082     is unable to process the message at this time.
3083   </doc>
3084   <doc name = "rule">
3085     A client MUST NOT use this method as a means of selecting messages
3086     to process.  A rejected message MAY be discarded or dead-lettered,
3087     not necessarily passed to another client.
3088   </doc>
3089   <chassis name = "server" implement = "MUST" />
3090     
3091   <field name = "delivery tag" domain = "delivery tag" />
3092
3093   <field name = "requeue" type = "bit">
3094     requeue the message
3095     <doc>
3096       If this field is zero, the message will be discarded.  If this bit
3097       is 1, the server will attempt to requeue the message.
3098     </doc>
3099     <doc name = "rule">
3100       The server MUST NOT deliver the message to the same client within
3101       the context of the current channel.  The recommended strategy is
3102       to attempt to deliver the message to an alternative consumer, and
3103       if that is not possible, to move the message to a dead-letter
3104       queue.  The server MAY use more sophisticated tracking to hold
3105       the message on the queue and redeliver it to the same client at
3106       a later stage.
3107     </doc>
3108   </field>
3109 </method>
3110
3111 </class>
3112
3113   <class name="stream" handler="channel" index="80">
3114     <!--
3115 ======================================================
3116 ==       STREAMING
3117 ======================================================
3118 -->
3119   work with streaming content
3120
3121 <doc>
3122   The stream class provides methods that support multimedia streaming.
3123   The stream class uses the following semantics: one message is one
3124   packet of data; delivery is unacknowleged and unreliable; the consumer
3125   can specify quality of service parameters that the server can try to
3126   adhere to; lower-priority messages may be discarded in favour of high
3127   priority messages.
3128 </doc>
3129
3130 <doc name = "grammar">
3131     stream              = C:QOS S:QOS-OK
3132                         / C:CONSUME S:CONSUME-OK
3133                         / C:CANCEL S:CANCEL-OK
3134                         / C:PUBLISH content
3135                         / S:RETURN
3136                         / S:DELIVER content
3137 </doc>
3138
3139 <chassis name = "server" implement = "MAY" />
3140 <chassis name = "client" implement = "MAY" />
3141
3142 <doc name = "rule">
3143   The server SHOULD discard stream messages on a priority basis if
3144   the queue size exceeds some configured limit.
3145 </doc>
3146 <doc name = "rule">
3147   The server MUST implement at least 2 priority levels for stream
3148   messages, where priorities 0-4 and 5-9 are treated as two distinct
3149   levels. The server MAY implement up to 10 priority levels.
3150 </doc>
3151 <doc name = "rule">
3152   The server MUST implement automatic acknowledgements on stream
3153   content.  That is, as soon as a message is delivered to a client
3154   via a Deliver method, the server must remove it from the queue.
3155 </doc>
3156
3157
3158 <!--  These are the properties for a Stream content  -->
3159
3160 <field name = "content type" type = "shortstr">
3161     MIME content type
3162 </field>
3163 <field name = "content encoding" type = "shortstr">
3164     MIME content encoding
3165 </field>
3166 <field name = "headers" type = "table">
3167     Message header field table
3168 </field>
3169 <field name = "priority" type = "octet">
3170     The message priority, 0 to 9
3171 </field>
3172 <field name = "timestamp" type = "timestamp">
3173     The message timestamp
3174 </field>
3175
3176
3177 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3178
3179 <method name = "qos" synchronous = "1" index = "10">
3180   specify quality of service
3181   <doc>
3182     This method requests a specific quality of service.  The QoS can
3183     be specified for the current channel or for all channels on the
3184     connection.  The particular properties and semantics of a qos method
3185     always depend on the content class semantics.  Though the qos method
3186     could in principle apply to both peers, it is currently meaningful
3187     only for the server.
3188   </doc>
3189   <chassis name = "server" implement = "MUST" />
3190   <response name = "qos-ok" />
3191
3192   <field name = "prefetch size" type = "long">
3193     prefetch window in octets
3194     <doc>
3195       The client can request that messages be sent in advance so that
3196       when the client finishes processing a message, the following
3197       message is already held locally, rather than needing to be sent
3198       down the channel.  Prefetching gives a performance improvement.
3199       This field specifies the prefetch window size in octets. May be
3200       set to zero, meaning "no specific limit".  Note that other
3201       prefetch limits may still apply.
3202     </doc>
3203   </field>
3204
3205   <field name = "prefetch count" type = "short">
3206     prefetch window in messages
3207     <doc>
3208       Specifies a prefetch window in terms of whole messages.  This
3209       field may be used in combination with the prefetch-size field;
3210       a message will only be sent in advance if both prefetch windows
3211       (and those at the channel and connection level) allow it.
3212     </doc>
3213   </field>
3214
3215   <field name = "consume rate" type = "long">
3216     transfer rate in octets/second
3217     <doc>
3218       Specifies a desired transfer rate in octets per second. This is
3219       usually determined by the application that uses the streaming
3220       data.  A value of zero means "no limit", i.e. as rapidly as
3221       possible.
3222     </doc>
3223     <doc name = "rule">
3224       The server MAY ignore the prefetch values and consume rates,
3225       depending on the type of stream and the ability of the server
3226       to queue and/or reply it.  The server MAY drop low-priority
3227       messages in favour of high-priority messages.
3228     </doc>
3229   </field>
3230
3231   <field name = "global" type = "bit">
3232     apply to entire connection
3233     <doc>
3234       By default the QoS settings apply to the current channel only.  If
3235       this field is set, they are applied to the entire connection.
3236     </doc>
3237   </field>
3238 </method>
3239
3240 <method name = "qos-ok" synchronous = "1" index = "11">
3241   confirm the requested qos
3242   <doc>
3243     This method tells the client that the requested QoS levels could
3244     be handled by the server.  The requested QoS applies to all active
3245     consumers until a new QoS is defined.
3246   </doc>
3247   <chassis name = "client" implement = "MUST" />
3248 </method>
3249
3250 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3251
3252 <method name = "consume" synchronous = "1" index = "20">
3253   start a queue consumer
3254   <doc>
3255     This method asks the server to start a "consumer", which is a
3256     transient request for messages from a specific queue. Consumers
3257     last as long as the channel they were created on, or until the
3258     client cancels them.
3259   </doc>
3260   <doc name = "rule">
3261     The server SHOULD support at least 16 consumers per queue, unless
3262     the queue was declared as private, and ideally, impose no limit
3263     except as defined by available resources.
3264   </doc>
3265   <doc name = "rule">
3266     Streaming applications SHOULD use different channels to select
3267     different streaming resolutions. AMQP makes no provision for
3268     filtering and/or transforming streams except on the basis of
3269     priority-based selective delivery of individual messages.
3270   </doc>
3271   <chassis name = "server" implement = "MUST" />
3272   <response name = "consume-ok" />
3273
3274   <field name = "ticket" domain = "access ticket">
3275     <doc name = "rule">
3276       The client MUST provide a valid access ticket giving "read" access
3277       rights to the realm for the queue.
3278     </doc>
3279   </field>
3280
3281   <field name = "queue" domain = "queue name">
3282     <doc>
3283       Specifies the name of the queue to consume from.  If the queue name
3284       is null, refers to the current queue for the channel, which is the
3285       last declared queue.
3286     </doc>
3287     <doc name = "rule">
3288       If the client did not previously declare a queue, and the queue name
3289       in this method is empty, the server MUST raise a connection exception
3290       with reply code 530 (not allowed).
3291     </doc>
3292   </field>
3293
3294   <field name = "consumer tag" domain = "consumer tag">
3295     <doc>
3296       Specifies the identifier for the consumer. The consumer tag is
3297       local to a connection, so two clients can use the same consumer
3298       tags. If this field is empty the server will generate a unique
3299       tag.
3300     </doc>
3301     <doc name = "rule" test = "todo">
3302       The tag MUST NOT refer to an existing consumer. If the client
3303       attempts to create two consumers with the same non-empty tag
3304       the server MUST raise a connection exception with reply code
3305       530 (not allowed).
3306     </doc>
3307   </field>
3308
3309   <field name = "no local" domain = "no local" />
3310
3311   <field name = "exclusive" type = "bit">
3312     request exclusive access
3313     <doc>
3314       Request exclusive consumer access, meaning only this consumer can
3315       access the queue.
3316     </doc>
3317     <doc name = "rule" test = "amq_file_00">
3318       If the server cannot grant exclusive access to the queue when asked,
3319       - because there are other consumers active - it MUST raise a channel
3320       exception with return code 405 (resource locked).
3321     </doc>
3322   </field>
3323
3324   <field name = "nowait" type = "bit">
3325     do not send a reply method
3326     <doc>
3327     If set, the server will not respond to the method. The client should
3328     not wait for a reply method.  If the server could not complete the
3329     method it will raise a channel or connection exception.
3330     </doc>
3331   </field>
3332 </method>
3333
3334
3335 <method name = "consume-ok" synchronous = "1" index = "21">
3336   confirm a new consumer
3337   <doc>
3338     This method provides the client with a consumer tag which it may
3339     use in methods that work with the consumer.
3340   </doc>
3341   <chassis name = "client" implement = "MUST" />
3342
3343   <field name = "consumer tag" domain = "consumer tag">
3344     <doc>
3345       Holds the consumer tag specified by the client or provided by
3346       the server.
3347     </doc>
3348   </field>
3349 </method>
3350
3351 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3352
3353 <method name = "cancel" synchronous = "1" index = "30">
3354   end a queue consumer
3355   <doc>
3356     This method cancels a consumer.  Since message delivery is
3357     asynchronous the client may continue to receive messages for
3358     a short while after canceling a consumer.  It may process or
3359     discard these as appropriate.
3360   </doc>
3361   <chassis name = "server" implement = "MUST" />
3362   <response name = "cancel-ok" />
3363
3364   <field name = "consumer tag" domain = "consumer tag" />
3365
3366   <field name = "nowait" type = "bit">
3367     do not send a reply method
3368     <doc>
3369     If set, the server will not respond to the method. The client should
3370     not wait for a reply method.  If the server could not complete the
3371     method it will raise a channel or connection exception.
3372     </doc>
3373   </field>
3374 </method>
3375
3376 <method name = "cancel-ok" synchronous = "1" index = "31">
3377   confirm a cancelled consumer
3378   <doc>
3379     This method confirms that the cancellation was completed.
3380   </doc>
3381   <chassis name = "client" implement = "MUST" />
3382
3383   <field name = "consumer tag" domain = "consumer tag" />
3384 </method>
3385
3386
3387 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3388
3389 <method name = "publish" content = "1" index = "40">
3390   publish a message
3391   <doc>
3392     This method publishes a message to a specific exchange. The message
3393     will be routed to queues as defined by the exchange configuration
3394     and distributed to any active consumers as appropriate.
3395   </doc>
3396   <chassis name = "server" implement = "MUST" />
3397
3398   <field name = "ticket" domain = "access ticket">
3399     <doc name = "rule">
3400       The client MUST provide a valid access ticket giving "write"
3401       access rights to the access realm for the exchange.
3402     </doc>
3403   </field>
3404
3405   <field name = "exchange" domain = "exchange name">
3406     <doc>
3407       Specifies the name of the exchange to publish to.  The exchange
3408       name can be empty, meaning the default exchange.  If the exchange
3409       name is specified, and that exchange does not exist, the server
3410       will raise a channel exception.
3411     </doc>
3412     <doc name = "rule">
3413       The server MUST accept a blank exchange name to mean the default
3414       exchange.
3415     </doc>
3416     <doc name = "rule">
3417       If the exchange was declared as an internal exchange, the server
3418       MUST respond with a reply code 403 (access refused) and raise a
3419       channel exception.
3420     </doc>
3421     <doc name = "rule">
3422       The exchange MAY refuse stream content in which case it MUST
3423       respond with a reply code 540 (not implemented) and raise a
3424       channel exception.
3425     </doc>
3426   </field>
3427
3428   <field name = "routing key" type = "shortstr">
3429      Message routing key
3430     <doc>
3431       Specifies the routing key for the message.  The routing key is
3432       used for routing messages depending on the exchange configuration.
3433     </doc>
3434   </field>
3435
3436   <field name = "mandatory" type = "bit">
3437     indicate mandatory routing
3438     <doc>
3439       This flag tells the server how to react if the message cannot be
3440       routed to a queue.  If this flag is set, the server will return an
3441       unroutable message with a Return method.  If this flag is zero, the
3442       server silently drops the message.
3443     </doc>
3444     <doc name = "rule" test = "amq_stream_00">
3445       The server SHOULD implement the mandatory flag.
3446     </doc>
3447   </field>
3448
3449   <field name = "immediate" type = "bit">
3450     request immediate delivery
3451     <doc>
3452       This flag tells the server how to react if the message cannot be
3453       routed to a queue consumer immediately.  If this flag is set, the
3454       server will return an undeliverable message with a Return method.
3455       If this flag is zero, the server will queue the message, but with
3456       no guarantee that it will ever be consumed.
3457     </doc>
3458     <doc name = "rule" test = "amq_stream_00">
3459       The server SHOULD implement the immediate flag.
3460     </doc>
3461   </field>
3462 </method>
3463
3464 <method name = "return" content = "1" index = "50">
3465   return a failed message
3466   <doc>
3467     This method returns an undeliverable message that was published
3468     with the "immediate" flag set, or an unroutable message published
3469     with the "mandatory" flag set. The reply code and text provide
3470     information about the reason that the message was undeliverable.
3471   </doc>
3472   <chassis name = "client" implement = "MUST" />
3473
3474   <field name = "reply code" domain = "reply code" />
3475   <field name = "reply text" domain = "reply text" />
3476
3477   <field name = "exchange" domain = "exchange name">
3478     <doc>
3479       Specifies the name of the exchange that the message was
3480       originally published to.
3481     </doc>
3482   </field>
3483
3484   <field name = "routing key" type = "shortstr">
3485      Message routing key
3486     <doc>
3487       Specifies the routing key name specified when the message was
3488       published.
3489     </doc>     
3490   </field>
3491 </method>
3492
3493
3494 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3495
3496 <method name = "deliver" content = "1" index = "60">
3497   notify the client of a consumer message
3498   <doc>
3499     This method delivers a message to the client, via a consumer.  In
3500     the asynchronous message delivery model, the client starts a
3501     consumer using the Consume method, then the server responds with
3502     Deliver methods as and when messages arrive for that consumer.
3503   </doc>
3504   <chassis name = "client" implement = "MUST" />
3505
3506   <field name = "consumer tag" domain = "consumer tag" />
3507
3508   <field name = "delivery tag" domain = "delivery tag" />
3509
3510   <field name = "exchange" domain = "exchange name">
3511     <doc>
3512       Specifies the name of the exchange that the message was originally
3513       published to.
3514     </doc>
3515   </field>
3516
3517   <field name = "queue" domain = "queue name">
3518     <doc>
3519       Specifies the name of the queue that the message came from. Note
3520       that a single channel can start many consumers on different
3521       queues.
3522     </doc>
3523     <assert check = "notnull" />
3524   </field>
3525 </method>
3526   </class>
3527
3528   <class name="tx" handler="channel" index="90">
3529     <!--
3530 ======================================================
3531 ==       TRANSACTIONS
3532 ======================================================
3533 -->
3534   work with standard transactions
3535
3536 <doc>
3537   Standard transactions provide so-called "1.5 phase commit".  We can
3538   ensure that work is never lost, but there is a chance of confirmations
3539   being lost, so that messages may be resent.  Applications that use
3540   standard transactions must be able to detect and ignore duplicate
3541   messages.
3542 </doc>
3543     <rule implement="SHOULD">
3544   An client using standard transactions SHOULD be able to track all
3545   messages received within a reasonable period, and thus detect and
3546   reject duplicates of the same message. It SHOULD NOT pass these to
3547   the application layer.
3548 </rule>
3549     <doc name="grammar">
3550     tx                  = C:SELECT S:SELECT-OK
3551                         / C:COMMIT S:COMMIT-OK
3552                         / C:ROLLBACK S:ROLLBACK-OK
3553 </doc>
3554     <chassis name="server" implement="SHOULD"/>
3555     <chassis name="client" implement="MAY"/>
3556     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3557     <method name="select" synchronous="1" index="10">
3558 select standard transaction mode
3559   <doc>
3560     This method sets the channel to use standard transactions.  The
3561     client must use this method at least once on a channel before
3562     using the Commit or Rollback methods.
3563   </doc>
3564       <chassis name="server" implement="MUST"/>
3565       <response name="select-ok"/>
3566     </method>
3567     <method name="select-ok" synchronous="1" index="11">
3568 confirm transaction mode
3569   <doc>
3570     This method confirms to the client that the channel was successfully
3571     set to use standard transactions.
3572   </doc>
3573       <chassis name="client" implement="MUST"/>
3574     </method>
3575     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3576     <method name="commit" synchronous="1" index="20">
3577 commit the current transaction
3578   <doc>
3579     This method commits all messages published and acknowledged in
3580     the current transaction.  A new transaction starts immediately
3581     after a commit.
3582   </doc>
3583       <chassis name="server" implement="MUST"/>
3584       <response name="commit-ok"/>
3585     </method>
3586     <method name="commit-ok" synchronous="1" index="21">
3587 confirm a successful commit
3588   <doc>
3589     This method confirms to the client that the commit succeeded.
3590     Note that if a commit fails, the server raises a channel exception.
3591   </doc>
3592       <chassis name="client" implement="MUST"/>
3593     </method>
3594     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3595     <method name="rollback" synchronous="1" index="30">
3596 abandon the current transaction
3597   <doc>
3598     This method abandons all messages published and acknowledged in
3599     the current transaction.  A new transaction starts immediately
3600     after a rollback.
3601   </doc>
3602       <chassis name="server" implement="MUST"/>
3603       <response name="rollback-ok"/>
3604     </method>
3605     <method name="rollback-ok" synchronous="1" index="31">
3606 confirm a successful rollback
3607   <doc>
3608     This method confirms to the client that the rollback succeeded.
3609     Note that if an rollback fails, the server raises a channel exception.
3610   </doc>
3611       <chassis name="client" implement="MUST"/>
3612     </method>
3613   </class>
3614   <class name="dtx" handler="channel" index="100">
3615     <!--
3616 ======================================================
3617 ==       DISTRIBUTED TRANSACTIONS
3618 ======================================================
3619 -->
3620   work with distributed transactions
3621
3622 <doc>
3623   Distributed transactions provide so-called "2-phase commit".    The
3624   AMQP distributed transaction model supports the X-Open XA
3625   architecture and other distributed transaction implementations.
3626   The Dtx class assumes that the server has a private communications
3627   channel (not AMQP) to a distributed transaction coordinator.
3628 </doc>
3629     <doc name="grammar">
3630     dtx                 = C:SELECT S:SELECT-OK
3631                           C:START S:START-OK
3632 </doc>
3633     <chassis name="server" implement="MAY"/>
3634     <chassis name="client" implement="MAY"/>
3635     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3636     <method name="select" synchronous="1" index="10">
3637 select standard transaction mode
3638   <doc>
3639     This method sets the channel to use distributed transactions.  The
3640     client must use this method at least once on a channel before
3641     using the Start method.
3642   </doc>
3643       <chassis name="server" implement="MUST"/>
3644       <response name="select-ok"/>
3645     </method>
3646     <method name="select-ok" synchronous="1" index="11">
3647 confirm transaction mode
3648   <doc>
3649     This method confirms to the client that the channel was successfully
3650     set to use distributed transactions.
3651   </doc>
3652       <chassis name="client" implement="MUST"/>
3653     </method>
3654     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3655     <method name="start" synchronous="1" index="20">
3656   start a new distributed transaction
3657   <doc>
3658     This method starts a new distributed transaction.  This must be
3659     the first method on a new channel that uses the distributed
3660     transaction mode, before any methods that publish or consume
3661     messages.
3662   </doc>
3663       <chassis name="server" implement="MAY"/>
3664       <response name="start-ok"/>
3665       <field name="dtx identifier" type="shortstr">
3666     transaction identifier
3667     <doc>
3668       The distributed transaction key. This identifies the transaction
3669       so that the AMQP server can coordinate with the distributed
3670       transaction coordinator.
3671     </doc>
3672         <assert check="notnull"/>
3673       </field>
3674     </method>
3675     <method name="start-ok" synchronous="1" index="21">
3676   confirm the start of a new distributed transaction
3677   <doc>
3678     This method confirms to the client that the transaction started.
3679     Note that if a start fails, the server raises a channel exception.
3680   </doc>
3681       <chassis name="client" implement="MUST"/>
3682     </method>
3683   </class>
3684   <class name="tunnel" handler="tunnel" index="110">
3685     <!--
3686 ======================================================
3687 ==       TUNNEL
3688 ======================================================
3689 -->
3690   methods for protocol tunneling.
3691
3692 <doc>
3693   The tunnel methods are used to send blocks of binary data - which
3694   can be serialised AMQP methods or other protocol frames - between
3695   AMQP peers.
3696 </doc>
3697     <doc name="grammar">
3698     tunnel              = C:REQUEST
3699                         / S:REQUEST
3700 </doc>
3701     <chassis name="server" implement="MAY"/>
3702     <chassis name="client" implement="MAY"/>
3703     <field name="headers" type="table">
3704     Message header field table
3705 </field>
3706     <field name="proxy name" type="shortstr">
3707     The identity of the tunnelling proxy
3708 </field>
3709     <field name="data name" type="shortstr">
3710     The name or type of the message being tunnelled
3711 </field>
3712     <field name="durable" type="octet">
3713     The message durability indicator
3714 </field>
3715     <field name="broadcast" type="octet">
3716     The message broadcast mode
3717 </field>
3718     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3719     <method name="request" content="1" index="10">
3720   sends a tunnelled method
3721   <doc>
3722     This method tunnels a block of binary data, which can be an
3723     encoded AMQP method or other data.  The binary data is sent
3724     as the content for the Tunnel.Request method.
3725   </doc>
3726       <chassis name="server" implement="MUST"/>
3727       <field name="meta data" type="table">
3728     meta data for the tunnelled block
3729     <doc>
3730     This field table holds arbitrary meta-data that the sender needs
3731     to pass to the recipient.
3732     </doc>
3733       </field>
3734     </method>
3735   </class>
3736   <class name="test" handler="channel" index="120">
3737     <!--
3738 ======================================================
3739 ==       TEST - CHECK FUNCTIONAL CAPABILITIES OF AN IMPLEMENTATION
3740 ======================================================
3741 -->
3742   test functional primitives of the implementation
3743
3744 <doc>
3745   The test class provides methods for a peer to test the basic
3746   operational correctness of another peer. The test methods are
3747   intended to ensure that all peers respect at least the basic
3748   elements of the protocol, such as frame and content organisation
3749   and field types. We assume that a specially-designed peer, a
3750   "monitor client" would perform such tests.
3751 </doc>
3752     <doc name="grammar">
3753     test                = C:INTEGER S:INTEGER-OK
3754                         / S:INTEGER C:INTEGER-OK
3755                         / C:STRING S:STRING-OK
3756                         / S:STRING C:STRING-OK
3757                         / C:TABLE S:TABLE-OK
3758                         / S:TABLE C:TABLE-OK
3759                         / C:CONTENT S:CONTENT-OK
3760                         / S:CONTENT C:CONTENT-OK
3761 </doc>
3762     <chassis name="server" implement="MUST"/>
3763     <chassis name="client" implement="SHOULD"/>
3764     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3765     <method name="integer" synchronous="1" index="10">
3766   test integer handling
3767   <doc>
3768     This method tests the peer's capability to correctly marshal integer
3769     data.
3770   </doc>
3771       <chassis name="client" implement="MUST"/>
3772       <chassis name="server" implement="MUST"/>
3773       <response name="integer-ok"/>
3774       <field name="integer 1" type="octet">
3775     octet test value
3776     <doc>
3777       An octet integer test value.
3778     </doc>
3779       </field>
3780       <field name="integer 2" type="short">
3781     short test value
3782     <doc>
3783       A short integer test value.
3784     </doc>
3785       </field>
3786       <field name="integer 3" type="long">
3787     long test value
3788     <doc>
3789       A long integer test value.
3790     </doc>
3791       </field>
3792       <field name="integer 4" type="longlong">
3793     long-long test value
3794     <doc>
3795       A long long integer test value.
3796     </doc>
3797       </field>
3798       <field name="operation" type="octet">
3799     operation to test
3800     <doc>
3801       The client must execute this operation on the provided integer
3802       test fields and return the result.
3803     </doc>
3804         <assert check="enum">
3805           <value name="add">return sum of test values</value>
3806           <value name="min">return lowest of test values</value>
3807           <value name="max">return highest of test values</value>
3808         </assert>
3809       </field>
3810     </method>
3811     <method name="integer-ok" synchronous="1" index="11">
3812   report integer test result
3813   <doc>
3814     This method reports the result of an Integer method.
3815   </doc>
3816       <chassis name="client" implement="MUST"/>
3817       <chassis name="server" implement="MUST"/>
3818       <field name="result" type="longlong">
3819     result value
3820     <doc>
3821       The result of the tested operation.
3822     </doc>
3823       </field>
3824     </method>
3825     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3826     <method name="string" synchronous="1" index="20">
3827   test string handling
3828   <doc>
3829     This method tests the peer's capability to correctly marshal string
3830     data.
3831   </doc>
3832       <chassis name="client" implement="MUST"/>
3833       <chassis name="server" implement="MUST"/>
3834       <response name="string-ok"/>
3835       <field name="string 1" type="shortstr">
3836     short string test value
3837     <doc>
3838       An short string test value.
3839     </doc>
3840       </field>
3841       <field name="string 2" type="longstr">
3842     long string test value
3843     <doc>
3844       A long string test value.
3845     </doc>
3846       </field>
3847       <field name="operation" type="octet">
3848     operation to test
3849     <doc>
3850       The client must execute this operation on the provided string
3851       test fields and return the result.
3852     </doc>
3853         <assert check="enum">
3854           <value name="add">return concatentation of test strings</value>
3855           <value name="min">return shortest of test strings</value>
3856           <value name="max">return longest of test strings</value>
3857         </assert>
3858       </field>
3859     </method>
3860     <method name="string-ok" synchronous="1" index="21">
3861   report string test result
3862   <doc>
3863     This method reports the result of a String method.
3864   </doc>
3865       <chassis name="client" implement="MUST"/>
3866       <chassis name="server" implement="MUST"/>
3867       <field name="result" type="longstr">
3868     result value
3869     <doc>
3870       The result of the tested operation.
3871     </doc>
3872       </field>
3873     </method>
3874     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3875     <method name="table" synchronous="1" index="30">
3876   test field table handling
3877   <doc>
3878     This method tests the peer's capability to correctly marshal field
3879     table data.
3880   </doc>
3881       <chassis name="client" implement="MUST"/>
3882       <chassis name="server" implement="MUST"/>
3883       <response name="table-ok"/>
3884       <field name="table" type="table">
3885     field table of test values
3886     <doc>
3887       A field table of test values.
3888     </doc>
3889       </field>
3890       <field name="integer op" type="octet">
3891     operation to test on integers
3892     <doc>
3893       The client must execute this operation on the provided field
3894       table integer values and return the result.
3895     </doc>
3896         <assert check="enum">
3897           <value name="add">return sum of numeric field values</value>
3898           <value name="min">return min of numeric field values</value>
3899           <value name="max">return max of numeric field values</value>
3900         </assert>
3901       </field>
3902       <field name="string op" type="octet">
3903     operation to test on strings
3904     <doc>
3905       The client must execute this operation on the provided field
3906       table string values and return the result.
3907     </doc>
3908         <assert check="enum">
3909           <value name="add">return concatenation of string field values</value>
3910           <value name="min">return shortest of string field values</value>
3911           <value name="max">return longest of string field values</value>
3912         </assert>
3913       </field>
3914     </method>
3915     <method name="table-ok" synchronous="1" index="31">
3916   report table test result
3917   <doc>
3918     This method reports the result of a Table method.
3919   </doc>
3920       <chassis name="client" implement="MUST"/>
3921       <chassis name="server" implement="MUST"/>
3922       <field name="integer result" type="longlong">
3923     integer result value
3924     <doc>
3925       The result of the tested integer operation.
3926     </doc>
3927       </field>
3928       <field name="string result" type="longstr">
3929     string result value
3930     <doc>
3931       The result of the tested string operation.
3932     </doc>
3933       </field>
3934     </method>
3935     <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
3936     <method name="content" synchronous="1" content="1" index="40">
3937   test content handling
3938   <doc>
3939     This method tests the peer's capability to correctly marshal content.
3940   </doc>
3941       <chassis name="client" implement="MUST"/>
3942       <chassis name="server" implement="MUST"/>
3943       <response name="content-ok"/>
3944     </method>
3945     <method name="content-ok" synchronous="1" content="1" index="41">
3946   report content test result
3947   <doc>
3948     This method reports the result of a Content method.  It contains the
3949     content checksum and echoes the original content as provided.
3950   </doc>
3951       <chassis name="client" implement="MUST"/>
3952       <chassis name="server" implement="MUST"/>
3953       <field name="content checksum" type="long">
3954     content hash
3955     <doc>
3956       The 32-bit checksum of the content, calculated by adding the
3957       content into a 32-bit accumulator.
3958     </doc>
3959       </field>
3960     </method>
3961   </class>
3962 </amqp>