sparqcode_bunny 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/.gitignore +10 -0
  2. data/.rspec +3 -0
  3. data/.travis.yml +15 -0
  4. data/.yardopts +9 -0
  5. data/CHANGELOG +27 -0
  6. data/Gemfile +39 -0
  7. data/LICENSE +21 -0
  8. data/README.textile +82 -0
  9. data/Rakefile +14 -0
  10. data/bunny.gemspec +43 -0
  11. data/examples/simple_08.rb +32 -0
  12. data/examples/simple_09.rb +32 -0
  13. data/examples/simple_ack_08.rb +35 -0
  14. data/examples/simple_ack_09.rb +35 -0
  15. data/examples/simple_consumer_08.rb +55 -0
  16. data/examples/simple_consumer_09.rb +55 -0
  17. data/examples/simple_fanout_08.rb +41 -0
  18. data/examples/simple_fanout_09.rb +41 -0
  19. data/examples/simple_headers_08.rb +42 -0
  20. data/examples/simple_headers_09.rb +42 -0
  21. data/examples/simple_publisher_08.rb +29 -0
  22. data/examples/simple_publisher_09.rb +29 -0
  23. data/examples/simple_topic_08.rb +61 -0
  24. data/examples/simple_topic_09.rb +61 -0
  25. data/ext/amqp-0.8.json +616 -0
  26. data/ext/amqp-0.9.1.json +388 -0
  27. data/ext/config.yml +4 -0
  28. data/ext/qparser.rb +469 -0
  29. data/lib/bunny/channel08.rb +39 -0
  30. data/lib/bunny/channel09.rb +39 -0
  31. data/lib/bunny/client08.rb +472 -0
  32. data/lib/bunny/client09.rb +374 -0
  33. data/lib/bunny/consumer.rb +35 -0
  34. data/lib/bunny/exchange08.rb +171 -0
  35. data/lib/bunny/exchange09.rb +159 -0
  36. data/lib/bunny/queue08.rb +403 -0
  37. data/lib/bunny/queue09.rb +325 -0
  38. data/lib/bunny/subscription08.rb +87 -0
  39. data/lib/bunny/subscription09.rb +87 -0
  40. data/lib/bunny/system_timer.rb +14 -0
  41. data/lib/bunny/version.rb +5 -0
  42. data/lib/bunny.rb +109 -0
  43. data/lib/qrack/amq-client-url.rb +165 -0
  44. data/lib/qrack/channel.rb +20 -0
  45. data/lib/qrack/client.rb +235 -0
  46. data/lib/qrack/errors.rb +5 -0
  47. data/lib/qrack/protocol/protocol08.rb +134 -0
  48. data/lib/qrack/protocol/protocol09.rb +135 -0
  49. data/lib/qrack/protocol/spec08.rb +828 -0
  50. data/lib/qrack/protocol/spec09.rb +524 -0
  51. data/lib/qrack/qrack08.rb +20 -0
  52. data/lib/qrack/qrack09.rb +20 -0
  53. data/lib/qrack/queue.rb +40 -0
  54. data/lib/qrack/subscription.rb +112 -0
  55. data/lib/qrack/transport/buffer08.rb +278 -0
  56. data/lib/qrack/transport/buffer09.rb +280 -0
  57. data/lib/qrack/transport/frame08.rb +117 -0
  58. data/lib/qrack/transport/frame09.rb +97 -0
  59. data/spec/spec_08/bunny_spec.rb +77 -0
  60. data/spec/spec_08/connection_spec.rb +25 -0
  61. data/spec/spec_08/exchange_spec.rb +173 -0
  62. data/spec/spec_08/queue_spec.rb +235 -0
  63. data/spec/spec_09/amqp_url_spec.rb +19 -0
  64. data/spec/spec_09/bunny_spec.rb +76 -0
  65. data/spec/spec_09/connection_spec.rb +29 -0
  66. data/spec/spec_09/exchange_spec.rb +173 -0
  67. data/spec/spec_09/queue_spec.rb +248 -0
  68. metadata +151 -0
@@ -0,0 +1,388 @@
1
+ {
2
+ "name": "AMQP",
3
+ "major-version": 0,
4
+ "minor-version": 9,
5
+ "revision": 1,
6
+ "port": 5672,
7
+ "copyright": [
8
+ "Copyright (C) 2008-2009 LShift Ltd, Cohesive Financial Technologies LLC,\n",
9
+ "and Rabbit Technologies Ltd\n",
10
+ "\n",
11
+ "Permission is hereby granted, free of charge, to any person\n",
12
+ "obtaining a copy of this file (the \"Software\"), to deal in the\n",
13
+ "Software without restriction, including without limitation the \n",
14
+ "rights to use, copy, modify, merge, publish, distribute, \n",
15
+ "sublicense, and/or sell copies of the Software, and to permit \n",
16
+ "persons to whom the Software is furnished to do so, subject to \n",
17
+ "the following conditions:\n",
18
+ "\n",
19
+ "The above copyright notice and this permission notice shall be\n",
20
+ "included in all copies or substantial portions of the Software.\n",
21
+ "\n",
22
+ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n",
23
+ "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n",
24
+ "OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n",
25
+ "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n",
26
+ "HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n",
27
+ "WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n",
28
+ "FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n",
29
+ "OTHER DEALINGS IN THE SOFTWARE.\n",
30
+ "\n",
31
+ "Class information entered from amqp_xml0-8.pdf and domain types from amqp-xml-doc0-9.pdf\n",
32
+ "Updated for 0-9-1 by Tony Garnock-Jones\n",
33
+ "\n",
34
+ "b3cb053f15e7b98808c0ccc67f23cb3e amqp_xml0-8.pdf\n",
35
+ "http://www.twiststandards.org/index.php?option=com_docman&task=cat_view&gid=28&&Itemid=90\n",
36
+ "8444db91e2949dbecfb2585e9eef6d64 amqp-xml-doc0-9.pdf\n",
37
+ "https://jira.amqp.org/confluence/download/attachments/720900/amqp-xml-doc0-9.pdf?version=1\n"],
38
+
39
+ "domains": [
40
+ ["bit", "bit"],
41
+ ["channel-id", "longstr"],
42
+ ["class-id", "short"],
43
+ ["consumer-tag", "shortstr"],
44
+ ["delivery-tag", "longlong"],
45
+ ["destination", "shortstr"],
46
+ ["duration", "longlong"],
47
+ ["exchange-name", "shortstr"],
48
+ ["long", "long"],
49
+ ["longlong", "longlong"],
50
+ ["longstr", "longstr"],
51
+ ["method-id", "short"],
52
+ ["no-ack", "bit"],
53
+ ["no-local", "bit"],
54
+ ["octet", "octet"],
55
+ ["offset", "longlong"],
56
+ ["path", "shortstr"],
57
+ ["peer-properties", "table"],
58
+ ["queue-name", "shortstr"],
59
+ ["redelivered", "bit"],
60
+ ["reference", "longstr"],
61
+ ["reject-code", "short"],
62
+ ["reject-text", "shortstr"],
63
+ ["reply-code", "short"],
64
+ ["reply-text", "shortstr"],
65
+ ["security-token", "longstr"],
66
+ ["short", "short"],
67
+ ["shortstr", "shortstr"],
68
+ ["table", "table"],
69
+ ["timestamp", "timestamp"]
70
+ ],
71
+
72
+ "constants": [
73
+ {"name": "FRAME-METHOD", "value": 1},
74
+ {"name": "FRAME-HEADER", "value": 2},
75
+ {"name": "FRAME-BODY", "value": 3},
76
+ {"name": "FRAME-HEARTBEAT", "value": 8},
77
+ {"name": "FRAME-MIN-SIZE", "value": 4096},
78
+ {"name": "FRAME-END", "value": 206},
79
+ {"name": "REPLY-SUCCESS", "value": 200},
80
+ {"name": "CONTENT-TOO-LARGE", "value": 311, "class": "soft-error"},
81
+ {"name": "NO-ROUTE", "value": 312, "class": "soft-error"},
82
+ {"name": "NO-CONSUMERS", "value": 313, "class": "soft-error"},
83
+ {"name": "ACCESS-REFUSED", "value": 403, "class": "soft-error"},
84
+ {"name": "NOT-FOUND", "value": 404, "class": "soft-error"},
85
+ {"name": "RESOURCE-LOCKED", "value": 405, "class": "soft-error"},
86
+ {"name": "PRECONDITION-FAILED", "value": 406, "class": "soft-error"},
87
+ {"name": "CONNECTION-FORCED", "value": 320, "class": "hard-error"},
88
+ {"name": "INVALID-PATH", "value": 402, "class": "hard-error"},
89
+ {"name": "FRAME-ERROR", "value": 501, "class": "hard-error"},
90
+ {"name": "SYNTAX-ERROR", "value": 502, "class": "hard-error"},
91
+ {"name": "COMMAND-INVALID", "value": 503, "class": "hard-error"},
92
+ {"name": "CHANNEL-ERROR", "value": 504, "class": "hard-error"},
93
+ {"name": "UNEXPECTED-FRAME", "value": 505, "class": "hard-error"},
94
+ {"name": "RESOURCE-ERROR", "value": 506, "class": "hard-error"},
95
+ {"name": "NOT-ALLOWED", "value": 530, "class": "hard-error"},
96
+ {"name": "NOT-IMPLEMENTED", "value": 540, "class": "hard-error"},
97
+ {"name": "INTERNAL-ERROR", "value": 541, "class": "hard-error"}
98
+ ],
99
+
100
+ "classes": [
101
+ {
102
+ "id": 10,
103
+ "methods": [{"id": 10,
104
+ "arguments": [{"type": "octet", "name": "version-major", "default-value": 0},
105
+ {"type": "octet", "name": "version-minor", "default-value": 8},
106
+ {"domain": "peer-properties", "name": "server properties"},
107
+ {"type": "longstr", "name": "mechanisms", "default-value": "PLAIN"},
108
+ {"type": "longstr", "name": "locales", "default-value": "en_US"}],
109
+ "name": "start"},
110
+ {"id": 11,
111
+ "arguments": [{"domain": "peer-properties", "name": "client-properties"},
112
+ {"type": "shortstr", "name": "mechanism", "default-value": "PLAIN"},
113
+ {"type": "longstr", "name": "response"},
114
+ {"type": "shortstr", "name": "locale", "default-value": "en_US"}],
115
+ "name": "start-ok"},
116
+ {"id": 20,
117
+ "arguments": [{"type": "longstr", "name": "challenge"}],
118
+ "name": "secure"},
119
+ {"id": 21,
120
+ "arguments": [{"type": "longstr", "name": "response"}],
121
+ "name": "secure-ok"},
122
+ {"id": 30,
123
+ "arguments": [{"type": "short", "name": "channel-max", "default-value": 0},
124
+ {"type": "long", "name": "frame-max", "default-value": 0},
125
+ {"type": "short", "name": "heartbeat", "default-value": 0}],
126
+ "name": "tune"},
127
+ {"id": 31,
128
+ "arguments": [{"type": "short", "name": "channel-max", "default-value": 0},
129
+ {"type": "long", "name": "frame-max", "default-value": 0},
130
+ {"type": "short", "name": "heartbeat", "default-value": 0}],
131
+ "name": "tune-ok"},
132
+ {"id": 40,
133
+ "arguments": [{"type": "shortstr", "name": "virtual-host", "default-value": "/"},
134
+ {"type": "shortstr", "name": "deprecated-capabilities", "default-value": ""},
135
+ {"type": "bit", "name": "deprecated-insist", "default-value": false}],
136
+ "name": "open"},
137
+ {"id": 41,
138
+ "arguments": [{"type": "shortstr", "name": "deprecated-known-hosts", "default-value": ""}],
139
+ "name": "open-ok"},
140
+ {"id": 50,
141
+ "arguments": [{"type": "short", "name": "reply-code"},
142
+ {"type": "shortstr", "name": "reply-text", "default-value": ""},
143
+ {"type": "short", "name": "class-id"},
144
+ {"type": "short", "name": "method-id"}],
145
+ "name": "close"},
146
+ {"id": 51,
147
+ "arguments": [],
148
+ "name": "close-ok"}],
149
+ "name": "connection",
150
+ "properties": []
151
+ },
152
+ {
153
+ "id": 20,
154
+ "methods": [{"id": 10,
155
+ "arguments": [{"type": "shortstr", "name": "deprecated-out-of-band", "default-value": ""}],
156
+ "name": "open"},
157
+ {"id": 11,
158
+ "arguments": [{"type": "longstr", "name": "deprecated-channel-id", "default-value": ""}],
159
+ "name": "open-ok"},
160
+ {"id": 20,
161
+ "arguments": [{"type": "bit", "name": "active"}],
162
+ "name": "flow"},
163
+ {"id": 21,
164
+ "arguments": [{"type": "bit", "name": "active"}],
165
+ "name": "flow-ok"},
166
+ {"id": 40,
167
+ "arguments": [{"type": "short", "name": "reply-code"},
168
+ {"type": "shortstr", "name": "reply-text", "default-value": ""},
169
+ {"type": "short", "name": "class-id"},
170
+ {"type": "short", "name": "method-id"}],
171
+ "name": "close"},
172
+ {"id": 41,
173
+ "arguments": [],
174
+ "name": "close-ok"}],
175
+ "name": "channel"
176
+ },
177
+ {
178
+ "id": 40,
179
+ "methods": [{"id": 10,
180
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
181
+ {"type": "shortstr", "name": "exchange"},
182
+ {"type": "shortstr", "name": "type", "default-value": "direct"},
183
+ {"type": "bit", "name": "passive", "default-value": false},
184
+ {"type": "bit", "name": "durable", "default-value": false},
185
+ {"type": "bit", "name": "deprecated-auto-delete", "default-value": false},
186
+ {"type": "bit", "name": "deprecated-internal", "default-value": false},
187
+ {"type": "bit", "name": "nowait", "default-value": false},
188
+ {"type": "table", "name": "arguments", "default-value": {}}],
189
+ "name": "declare"},
190
+ {"id": 11,
191
+ "arguments": [],
192
+ "name": "declare-ok"},
193
+ {"id": 20,
194
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
195
+ {"type": "shortstr", "name": "exchange"},
196
+ {"type": "bit", "name": "if-unused", "default-value": false},
197
+ {"type": "bit", "name": "nowait", "default-value": false}],
198
+ "name": "delete"},
199
+ {"id": 21,
200
+ "arguments": [],
201
+ "name": "delete-ok"}],
202
+ "name": "exchange"
203
+ },
204
+ {
205
+ "id": 50,
206
+ "methods": [{"id": 10,
207
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
208
+ {"type": "shortstr", "name": "queue", "default-value": ""},
209
+ {"type": "bit", "name": "passive", "default-value": false},
210
+ {"type": "bit", "name": "durable", "default-value": false},
211
+ {"type": "bit", "name": "exclusive", "default-value": false},
212
+ {"type": "bit", "name": "auto-delete", "default-value": false},
213
+ {"type": "bit", "name": "nowait", "default-value": false},
214
+ {"type": "table", "name": "arguments", "default-value": {}}],
215
+ "name": "declare"},
216
+ {"id": 11,
217
+ "arguments": [{"type": "shortstr", "name": "queue"},
218
+ {"type": "long", "name": "message-count"},
219
+ {"type": "long", "name": "consumer-count"}],
220
+ "name": "declare-ok"},
221
+ {"id": 20,
222
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
223
+ {"type": "shortstr", "name": "queue"},
224
+ {"type": "shortstr", "name": "exchange"},
225
+ {"type": "shortstr", "name": "routing-key"},
226
+ {"type": "bit", "name": "nowait", "default-value": false},
227
+ {"type": "table", "name": "arguments", "default-value": {}}],
228
+ "name": "bind"},
229
+ {"id": 21,
230
+ "arguments": [],
231
+ "name": "bind-ok"},
232
+ {"id": 30,
233
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
234
+ {"type": "shortstr", "name": "queue"},
235
+ {"type": "bit", "name": "nowait", "default-value": false}],
236
+ "name": "purge"},
237
+ {"id": 31,
238
+ "arguments": [{"type": "long", "name": "message-count"}],
239
+ "name": "purge-ok"},
240
+ {"id": 40,
241
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
242
+ {"type": "shortstr", "name": "queue"},
243
+ {"type": "bit", "name": "if-unused", "default-value": false},
244
+ {"type": "bit", "name": "if-empty", "default-value": false},
245
+ {"type": "bit", "name": "nowait", "default-value": false}],
246
+ "name": "delete"},
247
+ {"id": 41,
248
+ "arguments": [{"type": "long", "name": "message-count"}],
249
+ "name": "delete-ok"},
250
+ {"id": 50,
251
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
252
+ {"type": "shortstr", "name": "queue"},
253
+ {"type": "shortstr", "name": "exchange"},
254
+ {"type": "shortstr", "name": "routing-key"},
255
+ {"type": "table", "name": "arguments"}],
256
+ "name": "unbind"},
257
+ {"id": 51,
258
+ "arguments": [],
259
+ "name": "unbind-ok"}
260
+ ],
261
+ "name": "queue"
262
+ },
263
+ {
264
+ "id": 60,
265
+ "methods": [{"id": 10,
266
+ "arguments": [{"type": "long", "name": "prefetch-size", "default-value": 0},
267
+ {"type": "short", "name": "prefetch-count", "default-value": 0},
268
+ {"type": "bit", "name": "global", "default-value": false}],
269
+ "name": "qos"},
270
+ {"id": 11,
271
+ "arguments": [],
272
+ "name": "qos-ok"},
273
+ {"id": 20,
274
+ "arguments": [{"domain": "short", "name": "deprecated-ticket", "default-value": 1},
275
+ {"domain": "queue-name", "name": "queue"},
276
+ {"type": "shortstr", "name": "consumer-tag"},
277
+ {"type": "bit", "name": "no-local", "default-value": false},
278
+ {"type": "bit", "name": "no-ack", "default-value": false},
279
+ {"type": "bit", "name": "exclusive", "default-value": false},
280
+ {"type": "bit", "name": "nowait", "default-value": false},
281
+ {"type": "table", "name": "filter", "default-value": {}}],
282
+ "name": "consume"},
283
+ {"id": 21,
284
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
285
+ "name": "consume-ok"},
286
+ {"id": 30,
287
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
288
+ {"type": "bit", "name": "nowait", "default-value": false}],
289
+ "name": "cancel"},
290
+ {"id": 31,
291
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"}],
292
+ "name": "cancel-ok"},
293
+ {"content": true,
294
+ "id": 40,
295
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
296
+ {"type": "shortstr", "name": "exchange", "default-value": ""},
297
+ {"type": "shortstr", "name": "routing-key"},
298
+ {"type": "bit", "name": "mandatory", "default-value": false},
299
+ {"type": "bit", "name": "immediate", "default-value": false}],
300
+ "name": "publish"},
301
+ {"content": true,
302
+ "id": 50,
303
+ "arguments": [{"type": "short", "name": "reply-code"},
304
+ {"type": "shortstr", "name": "reply-text", "default-value": ""},
305
+ {"type": "shortstr", "name": "exchange"},
306
+ {"type": "shortstr", "name": "routing-key"}],
307
+ "name": "return"},
308
+ {"content": true,
309
+ "id": 60,
310
+ "arguments": [{"type": "shortstr", "name": "consumer-tag"},
311
+ {"type": "longlong", "name": "delivery-tag"},
312
+ {"type": "bit", "name": "redelivered", "default-value": false},
313
+ {"type": "shortstr", "name": "exchange"},
314
+ {"type": "shortstr", "name": "routing-key"}],
315
+ "name": "deliver"},
316
+ {"id": 70,
317
+ "arguments": [{"type": "short", "name": "deprecated-ticket", "default-value": 1},
318
+ {"type": "shortstr", "name": "queue"},
319
+ {"type": "bit", "name": "no-ack", "default-value": false}],
320
+ "name": "get"},
321
+ {"content": true,
322
+ "id": 71,
323
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
324
+ {"type": "bit", "name": "redelivered", "default-value": false},
325
+ {"type": "shortstr", "name": "exchange"},
326
+ {"type": "shortstr", "name": "routing-key"},
327
+ {"type": "long", "name": "message-count"}],
328
+ "name": "get-ok"},
329
+ {"id": 72,
330
+ "arguments": [{"type": "shortstr", "name": "deprecated-cluster-id", "default-value": ""}],
331
+ "name": "get-empty"},
332
+ {"id": 80,
333
+ "arguments": [{"type": "longlong", "name": "delivery-tag", "default-value": 0},
334
+ {"type": "bit", "name": "multiple", "default-value": true}],
335
+ "name": "ack"},
336
+ {"id": 90,
337
+ "arguments": [{"type": "longlong", "name": "delivery-tag"},
338
+ {"type": "bit", "name": "requeue", "default-value": true}],
339
+ "name": "reject"},
340
+ {"id": 100,
341
+ "arguments": [{"type": "bit", "name": "requeue", "default-value": false}],
342
+ "name": "recover-async"},
343
+ {"id": 110,
344
+ "arguments": [{"type": "bit", "name": "requeue", "default-value": false}],
345
+ "name": "recover"},
346
+ {"id": 111,
347
+ "arguments": [],
348
+ "name": "recover-ok"}],
349
+ "name": "basic",
350
+ "properties": [{"type": "shortstr", "name": "content-type"},
351
+ {"type": "shortstr", "name": "content-encoding"},
352
+ {"type": "table", "name": "headers"},
353
+ {"type": "octet", "name": "delivery-mode"},
354
+ {"type": "octet", "name": "priority"},
355
+ {"type": "shortstr", "name": "correlation-id"},
356
+ {"type": "shortstr", "name": "reply-to"},
357
+ {"type": "shortstr", "name": "expiration"},
358
+ {"type": "shortstr", "name": "message-id"},
359
+ {"type": "timestamp", "name": "timestamp"},
360
+ {"type": "shortstr", "name": "type"},
361
+ {"type": "shortstr", "name": "user-id"},
362
+ {"type": "shortstr", "name": "app-id"},
363
+ {"type": "shortstr", "name": "deprecated-cluster-id"}]
364
+ },
365
+ {
366
+ "id": 90,
367
+ "methods": [{"id": 10,
368
+ "arguments": [],
369
+ "name": "select"},
370
+ {"id": 11,
371
+ "arguments": [],
372
+ "name": "select-ok"},
373
+ {"id": 20,
374
+ "arguments": [],
375
+ "name": "commit"},
376
+ {"id": 21,
377
+ "arguments": [],
378
+ "name": "commit-ok"},
379
+ {"id": 30,
380
+ "arguments": [],
381
+ "name": "rollback"},
382
+ {"id": 31,
383
+ "arguments": [],
384
+ "name": "rollback-ok"}],
385
+ "name": "tx"
386
+ }
387
+ ]
388
+ }
data/ext/config.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :spec_out: '../lib/qrack/protocol/spec08.rb'
3
+ :frame_out: '../lib/qrack/transport/frame08.rb'
4
+ :spec_in: 'amqp-0.8.json'