Merge lp:~james-w/conn-check/amqp into lp:conn-check

Proposed by James Westby
Status: Merged
Approved by: Wes Mason
Approved revision: no longer in the source branch.
Merged at revision: 10
Proposed branch: lp:~james-w/conn-check/amqp
Merge into: lp:conn-check
Diff against target: 4157 lines (+4002/-31) (has conflicts)
7 files modified
.bzrignore (+1/-0)
Makefile (+1/-0)
conn_check/__init__.py (+41/-27)
conn_check/amqp0-8.xml (+3908/-0)
requirements.txt (+1/-0)
setup.py (+46/-0)
tests.py (+4/-4)
Text conflict in conn_check/__init__.py
Text conflict in setup.py
To merge this branch: bzr merge lp:~james-w/conn-check/amqp
Reviewer Review Type Date Requested Status
Wes Mason (community) Approve
Review via email: mp+228154@code.launchpad.net

Commit message

Fix the AMQP check.

Description of the change

Hi,

This fixes the AMQP check, and makes a few small tweaks.

Thanks,

James

To post a comment you must log in.
lp:~james-w/conn-check/amqp updated
9. By James Westby

Add a --validate option to just check the config.
------------------------------------------------------------
Use --include-merged or -n0 to see merged revisions.

Revision history for this message
Wes Mason (wesmason) :
review: Approve
lp:~james-w/conn-check/amqp updated
10. By Wes Mason

Fix the AMQP check

Preview Diff

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

Subscribers

People subscribed via source and target branches