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