bunny 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +8 -1
- data/bunny.gemspec +44 -0
- data/examples/simple_headers.rb +40 -0
- data/lib/bunny.rb +34 -11
- data/lib/bunny/client08.rb +421 -0
- data/lib/bunny/{client.rb → client091.rb} +22 -12
- data/lib/bunny/{exchange.rb → exchange08.rb} +0 -0
- data/lib/bunny/exchange091.rb +158 -0
- data/lib/bunny/{queue.rb → queue08.rb} +0 -0
- data/lib/bunny/queue091.rb +458 -0
- data/lib/qrack/protocol/{spec.rb → spec08.rb} +0 -0
- data/lib/qrack/protocol/spec091.rb +520 -0
- data/lib/qrack/{qrack.rb → qrack08.rb} +2 -2
- data/lib/qrack/qrack091.rb +28 -0
- data/lib/qrack/transport/{frame.rb → frame08.rb} +0 -0
- data/lib/qrack/transport/frame091.rb +94 -0
- data/spec/bunny_spec.rb +4 -0
- data/spec/exchange_spec.rb +31 -10
- data/spec/queue_spec.rb +1 -1
- metadata +17 -9
File without changes
|
@@ -0,0 +1,520 @@
|
|
1
|
+
|
2
|
+
#:stopdoc:
|
3
|
+
# this file was autogenerated on Wed Jun 17 15:20:32 +0100 2009
|
4
|
+
# using amqp-0.9.1.xml (mtime: Fri May 01 14:14:29 +0100 2009)
|
5
|
+
#
|
6
|
+
# DO NOT EDIT! (edit ext/qparser.rb and config.yml instead, and run 'ruby qparser.rb')
|
7
|
+
|
8
|
+
module Qrack
|
9
|
+
module Protocol
|
10
|
+
HEADER = "AMQP".freeze
|
11
|
+
VERSION_MAJOR = 0
|
12
|
+
VERSION_MINOR = 9
|
13
|
+
REVISION = 1
|
14
|
+
PORT = 5672
|
15
|
+
|
16
|
+
RESPONSES = {
|
17
|
+
200 => :REPLY_SUCCESS,
|
18
|
+
311 => :CONTENT_TOO_LARGE,
|
19
|
+
313 => :NO_CONSUMERS,
|
20
|
+
320 => :CONNECTION_FORCED,
|
21
|
+
402 => :INVALID_PATH,
|
22
|
+
403 => :ACCESS_REFUSED,
|
23
|
+
404 => :NOT_FOUND,
|
24
|
+
405 => :RESOURCE_LOCKED,
|
25
|
+
406 => :PRECONDITION_FAILED,
|
26
|
+
502 => :SYNTAX_ERROR,
|
27
|
+
503 => :COMMAND_INVALID,
|
28
|
+
504 => :CHANNEL_ERROR,
|
29
|
+
505 => :UNEXPECTED_FRAME,
|
30
|
+
506 => :RESOURCE_ERROR,
|
31
|
+
530 => :NOT_ALLOWED,
|
32
|
+
540 => :NOT_IMPLEMENTED,
|
33
|
+
541 => :INTERNAL_ERROR,
|
34
|
+
}
|
35
|
+
|
36
|
+
FIELDS = [
|
37
|
+
:bit,
|
38
|
+
:long,
|
39
|
+
:longlong,
|
40
|
+
:longstr,
|
41
|
+
:octet,
|
42
|
+
:short,
|
43
|
+
:shortstr,
|
44
|
+
:table,
|
45
|
+
:timestamp,
|
46
|
+
]
|
47
|
+
|
48
|
+
class Class
|
49
|
+
class << self
|
50
|
+
FIELDS.each do |f|
|
51
|
+
class_eval %[
|
52
|
+
def #{f} name
|
53
|
+
properties << [ :#{f}, name ] unless properties.include?([:#{f}, name])
|
54
|
+
attr_accessor name
|
55
|
+
end
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
def properties() @properties ||= [] end
|
60
|
+
|
61
|
+
def id() self::ID end
|
62
|
+
def name() self::NAME end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Method
|
66
|
+
class << self
|
67
|
+
FIELDS.each do |f|
|
68
|
+
class_eval %[
|
69
|
+
def #{f} name
|
70
|
+
arguments << [ :#{f}, name ] unless arguments.include?([:#{f}, name])
|
71
|
+
attr_accessor name
|
72
|
+
end
|
73
|
+
]
|
74
|
+
end
|
75
|
+
|
76
|
+
def arguments() @arguments ||= [] end
|
77
|
+
|
78
|
+
def parent() Protocol.const_get(self.to_s[/Protocol::(.+?)::/,1]) end
|
79
|
+
def id() self::ID end
|
80
|
+
def name() self::NAME end
|
81
|
+
end
|
82
|
+
|
83
|
+
def == b
|
84
|
+
self.class.arguments.inject(true) do |eql, (type, name)|
|
85
|
+
eql and __send__("#{name}") == b.__send__("#{name}")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.methods() @methods ||= {} end
|
91
|
+
|
92
|
+
def self.Method(id, name)
|
93
|
+
@_base_methods ||= {}
|
94
|
+
@_base_methods[id] ||= ::Class.new(Method) do
|
95
|
+
class_eval %[
|
96
|
+
def self.inherited klass
|
97
|
+
klass.const_set(:ID, #{id})
|
98
|
+
klass.const_set(:NAME, :#{name.to_s})
|
99
|
+
klass.parent.methods[#{id}] = klass
|
100
|
+
klass.parent.methods[klass::NAME] = klass
|
101
|
+
end
|
102
|
+
]
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.classes() @classes ||= {} end
|
108
|
+
|
109
|
+
def self.Class(id, name)
|
110
|
+
@_base_classes ||= {}
|
111
|
+
@_base_classes[id] ||= ::Class.new(Class) do
|
112
|
+
class_eval %[
|
113
|
+
def self.inherited klass
|
114
|
+
klass.const_set(:ID, #{id})
|
115
|
+
klass.const_set(:NAME, :#{name.to_s})
|
116
|
+
Protocol.classes[#{id}] = klass
|
117
|
+
Protocol.classes[klass::NAME] = klass
|
118
|
+
end
|
119
|
+
]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
module Qrack
|
126
|
+
module Protocol
|
127
|
+
class Connection < Class( 10, :connection ); end
|
128
|
+
class Channel < Class( 20, :channel ); end
|
129
|
+
class Exchange < Class( 40, :exchange ); end
|
130
|
+
class Queue < Class( 50, :queue ); end
|
131
|
+
class Basic < Class( 60, :basic ); end
|
132
|
+
class Tx < Class( 90, :tx ); end
|
133
|
+
|
134
|
+
class Connection
|
135
|
+
|
136
|
+
class Start < Method( 10, :start ); end
|
137
|
+
class StartOk < Method( 11, :start_ok ); end
|
138
|
+
class Secure < Method( 20, :secure ); end
|
139
|
+
class SecureOk < Method( 21, :secure_ok ); end
|
140
|
+
class Tune < Method( 30, :tune ); end
|
141
|
+
class TuneOk < Method( 31, :tune_ok ); end
|
142
|
+
class Open < Method( 40, :open ); end
|
143
|
+
class OpenOk < Method( 41, :open_ok ); end
|
144
|
+
class Close < Method( 50, :close ); end
|
145
|
+
class CloseOk < Method( 51, :close_ok ); end
|
146
|
+
|
147
|
+
|
148
|
+
class Start
|
149
|
+
octet :version_major
|
150
|
+
octet :version_minor
|
151
|
+
table :server_properties
|
152
|
+
longstr :mechanisms
|
153
|
+
longstr :locales
|
154
|
+
end
|
155
|
+
|
156
|
+
class StartOk
|
157
|
+
table :client_properties
|
158
|
+
shortstr :mechanism
|
159
|
+
longstr :response
|
160
|
+
shortstr :locale
|
161
|
+
end
|
162
|
+
|
163
|
+
class Secure
|
164
|
+
longstr :challenge
|
165
|
+
end
|
166
|
+
|
167
|
+
class SecureOk
|
168
|
+
longstr :response
|
169
|
+
end
|
170
|
+
|
171
|
+
class Tune
|
172
|
+
short :channel_max
|
173
|
+
long :frame_max
|
174
|
+
short :heartbeat
|
175
|
+
end
|
176
|
+
|
177
|
+
class TuneOk
|
178
|
+
short :channel_max
|
179
|
+
long :frame_max
|
180
|
+
short :heartbeat
|
181
|
+
end
|
182
|
+
|
183
|
+
class Open
|
184
|
+
shortstr :virtual_host
|
185
|
+
shortstr :reserved_1
|
186
|
+
bit :reserved_2
|
187
|
+
end
|
188
|
+
|
189
|
+
class OpenOk
|
190
|
+
shortstr :reserved_1
|
191
|
+
end
|
192
|
+
|
193
|
+
class Close
|
194
|
+
short :reply_code
|
195
|
+
shortstr :reply_text
|
196
|
+
short :class_id
|
197
|
+
short :method_id
|
198
|
+
end
|
199
|
+
|
200
|
+
class CloseOk
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|
204
|
+
|
205
|
+
class Channel
|
206
|
+
|
207
|
+
class Open < Method( 10, :open ); end
|
208
|
+
class OpenOk < Method( 11, :open_ok ); end
|
209
|
+
class Flow < Method( 20, :flow ); end
|
210
|
+
class FlowOk < Method( 21, :flow_ok ); end
|
211
|
+
class Close < Method( 40, :close ); end
|
212
|
+
class CloseOk < Method( 41, :close_ok ); end
|
213
|
+
|
214
|
+
|
215
|
+
class Open
|
216
|
+
shortstr :reserved_1
|
217
|
+
end
|
218
|
+
|
219
|
+
class OpenOk
|
220
|
+
longstr :reserved_1
|
221
|
+
end
|
222
|
+
|
223
|
+
class Flow
|
224
|
+
bit :active
|
225
|
+
end
|
226
|
+
|
227
|
+
class FlowOk
|
228
|
+
bit :active
|
229
|
+
end
|
230
|
+
|
231
|
+
class Close
|
232
|
+
short :reply_code
|
233
|
+
shortstr :reply_text
|
234
|
+
short :class_id
|
235
|
+
short :method_id
|
236
|
+
end
|
237
|
+
|
238
|
+
class CloseOk
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
class Exchange
|
244
|
+
|
245
|
+
class Declare < Method( 10, :declare ); end
|
246
|
+
class DeclareOk < Method( 11, :declare_ok ); end
|
247
|
+
class Delete < Method( 20, :delete ); end
|
248
|
+
class DeleteOk < Method( 21, :delete_ok ); end
|
249
|
+
|
250
|
+
|
251
|
+
class Declare
|
252
|
+
short :reserved_1
|
253
|
+
shortstr :exchange
|
254
|
+
shortstr :type
|
255
|
+
bit :passive
|
256
|
+
bit :durable
|
257
|
+
bit :reserved_2
|
258
|
+
bit :reserved_3
|
259
|
+
bit :no_wait
|
260
|
+
table :arguments
|
261
|
+
end
|
262
|
+
|
263
|
+
class DeclareOk
|
264
|
+
end
|
265
|
+
|
266
|
+
class Delete
|
267
|
+
short :reserved_1
|
268
|
+
shortstr :exchange
|
269
|
+
bit :if_unused
|
270
|
+
bit :no_wait
|
271
|
+
end
|
272
|
+
|
273
|
+
class DeleteOk
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
class Queue
|
279
|
+
|
280
|
+
class Declare < Method( 10, :declare ); end
|
281
|
+
class DeclareOk < Method( 11, :declare_ok ); end
|
282
|
+
class Bind < Method( 20, :bind ); end
|
283
|
+
class BindOk < Method( 21, :bind_ok ); end
|
284
|
+
class Unbind < Method( 50, :unbind ); end
|
285
|
+
class UnbindOk < Method( 51, :unbind_ok ); end
|
286
|
+
class Purge < Method( 30, :purge ); end
|
287
|
+
class PurgeOk < Method( 31, :purge_ok ); end
|
288
|
+
class Delete < Method( 40, :delete ); end
|
289
|
+
class DeleteOk < Method( 41, :delete_ok ); end
|
290
|
+
|
291
|
+
|
292
|
+
class Declare
|
293
|
+
short :reserved_1
|
294
|
+
shortstr :queue
|
295
|
+
bit :passive
|
296
|
+
bit :durable
|
297
|
+
bit :exclusive
|
298
|
+
bit :auto_delete
|
299
|
+
bit :no_wait
|
300
|
+
table :arguments
|
301
|
+
end
|
302
|
+
|
303
|
+
class DeclareOk
|
304
|
+
shortstr :queue
|
305
|
+
long :message_count
|
306
|
+
long :consumer_count
|
307
|
+
end
|
308
|
+
|
309
|
+
class Bind
|
310
|
+
short :reserved_1
|
311
|
+
shortstr :queue
|
312
|
+
shortstr :exchange
|
313
|
+
shortstr :routing_key
|
314
|
+
bit :no_wait
|
315
|
+
table :arguments
|
316
|
+
end
|
317
|
+
|
318
|
+
class BindOk
|
319
|
+
end
|
320
|
+
|
321
|
+
class Unbind
|
322
|
+
short :reserved_1
|
323
|
+
shortstr :queue
|
324
|
+
shortstr :exchange
|
325
|
+
shortstr :routing_key
|
326
|
+
table :arguments
|
327
|
+
end
|
328
|
+
|
329
|
+
class UnbindOk
|
330
|
+
end
|
331
|
+
|
332
|
+
class Purge
|
333
|
+
short :reserved_1
|
334
|
+
shortstr :queue
|
335
|
+
bit :no_wait
|
336
|
+
end
|
337
|
+
|
338
|
+
class PurgeOk
|
339
|
+
long :message_count
|
340
|
+
end
|
341
|
+
|
342
|
+
class Delete
|
343
|
+
short :reserved_1
|
344
|
+
shortstr :queue
|
345
|
+
bit :if_unused
|
346
|
+
bit :if_empty
|
347
|
+
bit :no_wait
|
348
|
+
end
|
349
|
+
|
350
|
+
class DeleteOk
|
351
|
+
long :message_count
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
|
356
|
+
class Basic
|
357
|
+
shortstr :content_type
|
358
|
+
shortstr :content_encoding
|
359
|
+
table :headers
|
360
|
+
octet :delivery_mode
|
361
|
+
octet :priority
|
362
|
+
shortstr :correlation_id
|
363
|
+
shortstr :reply_to
|
364
|
+
shortstr :expiration
|
365
|
+
shortstr :message_id
|
366
|
+
timestamp :timestamp
|
367
|
+
shortstr :type
|
368
|
+
shortstr :user_id
|
369
|
+
shortstr :app_id
|
370
|
+
shortstr :reserved
|
371
|
+
|
372
|
+
class Qos < Method( 10, :qos ); end
|
373
|
+
class QosOk < Method( 11, :qos_ok ); end
|
374
|
+
class Consume < Method( 20, :consume ); end
|
375
|
+
class ConsumeOk < Method( 21, :consume_ok ); end
|
376
|
+
class Cancel < Method( 30, :cancel ); end
|
377
|
+
class CancelOk < Method( 31, :cancel_ok ); end
|
378
|
+
class Publish < Method( 40, :publish ); end
|
379
|
+
class Return < Method( 50, :return ); end
|
380
|
+
class Deliver < Method( 60, :deliver ); end
|
381
|
+
class Get < Method( 70, :get ); end
|
382
|
+
class GetOk < Method( 71, :get_ok ); end
|
383
|
+
class GetEmpty < Method( 72, :get_empty ); end
|
384
|
+
class Ack < Method( 80, :ack ); end
|
385
|
+
class Reject < Method( 90, :reject ); end
|
386
|
+
class RecoverAsync < Method( 100, :recover_async ); end
|
387
|
+
class Recover < Method( 110, :recover ); end
|
388
|
+
class RecoverOk < Method( 111, :recover_ok ); end
|
389
|
+
|
390
|
+
|
391
|
+
class Qos
|
392
|
+
long :prefetch_size
|
393
|
+
short :prefetch_count
|
394
|
+
bit :global
|
395
|
+
end
|
396
|
+
|
397
|
+
class QosOk
|
398
|
+
end
|
399
|
+
|
400
|
+
class Consume
|
401
|
+
short :reserved_1
|
402
|
+
shortstr :queue
|
403
|
+
shortstr :consumer_tag
|
404
|
+
bit :no_local
|
405
|
+
bit :no_ack
|
406
|
+
bit :exclusive
|
407
|
+
bit :no_wait
|
408
|
+
table :arguments
|
409
|
+
end
|
410
|
+
|
411
|
+
class ConsumeOk
|
412
|
+
shortstr :consumer_tag
|
413
|
+
end
|
414
|
+
|
415
|
+
class Cancel
|
416
|
+
shortstr :consumer_tag
|
417
|
+
bit :no_wait
|
418
|
+
end
|
419
|
+
|
420
|
+
class CancelOk
|
421
|
+
shortstr :consumer_tag
|
422
|
+
end
|
423
|
+
|
424
|
+
class Publish
|
425
|
+
short :reserved_1
|
426
|
+
shortstr :exchange
|
427
|
+
shortstr :routing_key
|
428
|
+
bit :mandatory
|
429
|
+
bit :immediate
|
430
|
+
end
|
431
|
+
|
432
|
+
class Return
|
433
|
+
short :reply_code
|
434
|
+
shortstr :reply_text
|
435
|
+
shortstr :exchange
|
436
|
+
shortstr :routing_key
|
437
|
+
end
|
438
|
+
|
439
|
+
class Deliver
|
440
|
+
shortstr :consumer_tag
|
441
|
+
longlong :delivery_tag
|
442
|
+
bit :redelivered
|
443
|
+
shortstr :exchange
|
444
|
+
shortstr :routing_key
|
445
|
+
end
|
446
|
+
|
447
|
+
class Get
|
448
|
+
short :reserved_1
|
449
|
+
shortstr :queue
|
450
|
+
bit :no_ack
|
451
|
+
end
|
452
|
+
|
453
|
+
class GetOk
|
454
|
+
longlong :delivery_tag
|
455
|
+
bit :redelivered
|
456
|
+
shortstr :exchange
|
457
|
+
shortstr :routing_key
|
458
|
+
long :message_count
|
459
|
+
end
|
460
|
+
|
461
|
+
class GetEmpty
|
462
|
+
shortstr :reserved_1
|
463
|
+
end
|
464
|
+
|
465
|
+
class Ack
|
466
|
+
longlong :delivery_tag
|
467
|
+
bit :multiple
|
468
|
+
end
|
469
|
+
|
470
|
+
class Reject
|
471
|
+
longlong :delivery_tag
|
472
|
+
bit :requeue
|
473
|
+
end
|
474
|
+
|
475
|
+
class RecoverAsync
|
476
|
+
bit :requeue
|
477
|
+
end
|
478
|
+
|
479
|
+
class Recover
|
480
|
+
bit :requeue
|
481
|
+
end
|
482
|
+
|
483
|
+
class RecoverOk
|
484
|
+
end
|
485
|
+
|
486
|
+
end
|
487
|
+
|
488
|
+
class Tx
|
489
|
+
|
490
|
+
class Select < Method( 10, :select ); end
|
491
|
+
class SelectOk < Method( 11, :select_ok ); end
|
492
|
+
class Commit < Method( 20, :commit ); end
|
493
|
+
class CommitOk < Method( 21, :commit_ok ); end
|
494
|
+
class Rollback < Method( 30, :rollback ); end
|
495
|
+
class RollbackOk < Method( 31, :rollback_ok ); end
|
496
|
+
|
497
|
+
|
498
|
+
class Select
|
499
|
+
end
|
500
|
+
|
501
|
+
class SelectOk
|
502
|
+
end
|
503
|
+
|
504
|
+
class Commit
|
505
|
+
end
|
506
|
+
|
507
|
+
class CommitOk
|
508
|
+
end
|
509
|
+
|
510
|
+
class Rollback
|
511
|
+
end
|
512
|
+
|
513
|
+
class RollbackOk
|
514
|
+
end
|
515
|
+
|
516
|
+
end
|
517
|
+
|
518
|
+
end
|
519
|
+
|
520
|
+
end
|