amq-protocol 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +5 -5
- data/Gemfile +0 -1
- data/LICENSE +1 -0
- data/README.md +43 -0
- data/amq-protocol.gemspec +2 -1
- data/codegen.py +1 -1
- data/generate.rb +18 -0
- data/lib/amq/protocol/client.rb +233 -98
- data/lib/amq/protocol/version.rb +1 -1
- data/post-processing.rb +1 -1
- data/protocol.rb.pytemplate +1 -5
- data/spec/amq/protocol/basic_spec.rb +8 -0
- data/spec/amq/protocol/method_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -0
- metadata +11 -10
- data/README.textile +0 -50
- data/tasks.rb +0 -43
data/.travis.yml
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
|
1
|
+
language: ruby
|
2
2
|
bundler_args: --without development
|
3
|
-
before_install: gem install bundler --pre
|
4
3
|
script: "bundle exec rspec spec"
|
5
4
|
rvm:
|
6
5
|
- 1.8.7
|
7
6
|
- rbx-18mode
|
8
7
|
- rbx-19mode
|
9
|
-
- ree
|
10
|
-
- jruby
|
11
8
|
- 1.9.2
|
12
9
|
- 1.9.3
|
13
10
|
- ruby-head
|
11
|
+
- jruby-18mode
|
12
|
+
- jruby-19mode
|
13
|
+
- jruby-head
|
14
14
|
notifications:
|
15
15
|
recipients:
|
16
|
-
-
|
16
|
+
- michael@novemberain.com
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# What is amq-protocol.
|
2
|
+
|
3
|
+
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
|
4
|
+
AMQP client: amq-protocol only handles serialization and deserialization.
|
5
|
+
If you want to write your own AMQP client, this gem can help you with that.
|
6
|
+
|
7
|
+
## How does amq-protocol relate to amqp gem, amq-client and libraries like bunny?
|
8
|
+
|
9
|
+
See [this page about AMQP gems family](https://github.com/ruby-amqp/amq-client/blob/master/README.textile)
|
10
|
+
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
gem install amq-protocol
|
15
|
+
|
16
|
+
|
17
|
+
## Development
|
18
|
+
|
19
|
+
Make sure you have Python and the mako templating package installed. amq-protocol uses RabbitMQ protocol
|
20
|
+
code generation library that is in Python, so there is some Python involved in the build. Don't fret.
|
21
|
+
|
22
|
+
To regenerate `lib/amq/protocol/client.rb` from the source (`protocol.rb.pytemplate`), run
|
23
|
+
|
24
|
+
./generate.rb
|
25
|
+
|
26
|
+
To make changes, **do not edit client.rb directly**. Instead, edit `protocol.rb.pytemplate` and regenerate.
|
27
|
+
|
28
|
+
To run tests, use
|
29
|
+
|
30
|
+
bundle install --binstubs
|
31
|
+
./bin/rspec -c spec spec
|
32
|
+
|
33
|
+
|
34
|
+
## Maintainer Information
|
35
|
+
|
36
|
+
amq-protocol is maintained by [Michael Klishin](https://github.com/michaelklishin).
|
37
|
+
|
38
|
+
|
39
|
+
## Links
|
40
|
+
|
41
|
+
* [Continous integration server](http://travis-ci.org/#!/ruby-amqp/amq-protocol)
|
42
|
+
* [Ruby AMQP mailing list](http://groups.google.com/group/ruby-amqp)
|
43
|
+
* [Issue tracker](http://github.com/ruby-amqp/amq-protocol/issues)
|
data/amq-protocol.gemspec
CHANGED
@@ -17,12 +17,13 @@ Gem::Specification.new do |s|
|
|
17
17
|
If you want to write your own AMQP client, this gem can help you with that.
|
18
18
|
DESC
|
19
19
|
s.email = ["bWljaGFlbEBub3ZlbWJlcmFpbi5jb20=\n", "c3Rhc3RueUAxMDFpZGVhcy5jeg==\n"].map { |i| Base64.decode64(i) }
|
20
|
+
s.licenses = ["MIT"]
|
20
21
|
|
21
22
|
# files
|
22
23
|
s.files = `git ls-files`.split("\n").reject { |file| file =~ /^vendor\// }
|
23
24
|
s.require_paths = ["lib"]
|
24
25
|
|
25
|
-
s.extra_rdoc_files = ["README.
|
26
|
+
s.extra_rdoc_files = ["README.md"] + Dir.glob("doc/*")
|
26
27
|
|
27
28
|
|
28
29
|
# RubyForge
|
data/codegen.py
CHANGED
data/generate.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
def sh(*args)
|
5
|
+
system(*args)
|
6
|
+
end
|
7
|
+
|
8
|
+
spec = "vendor/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
|
9
|
+
unless File.exist?(spec)
|
10
|
+
sh "git submodule update --init"
|
11
|
+
end
|
12
|
+
|
13
|
+
path = "lib/amq/protocol/client.rb"
|
14
|
+
sh "./codegen.py client #{spec} #{path}"
|
15
|
+
if File.file?(path)
|
16
|
+
sh "./post-processing.rb #{path}"
|
17
|
+
sh "ruby -c #{path}"
|
18
|
+
end
|
data/lib/amq/protocol/client.rb
CHANGED
@@ -17,17 +17,19 @@ module AMQ
|
|
17
17
|
# caching
|
18
18
|
EMPTY_STRING = "".freeze
|
19
19
|
|
20
|
-
PACK_CHAR =
|
21
|
-
PACK_UINT16 =
|
22
|
-
PACK_UINT16_X2 =
|
23
|
-
PACK_UINT32 =
|
24
|
-
PACK_UINT32_X2 =
|
25
|
-
PACK_INT64 =
|
26
|
-
PACK_UCHAR_UINT32 =
|
27
|
-
PACK_CHAR_UINT16_UINT32 =
|
28
|
-
|
29
|
-
PACK_32BIT_FLOAT =
|
30
|
-
PACK_64BIT_FLOAT =
|
20
|
+
PACK_CHAR = 'C'.freeze
|
21
|
+
PACK_UINT16 = 'n'.freeze
|
22
|
+
PACK_UINT16_X2 = 'n2'.freeze
|
23
|
+
PACK_UINT32 = 'N'.freeze
|
24
|
+
PACK_UINT32_X2 = 'N2'.freeze
|
25
|
+
PACK_INT64 = 'q'.freeze
|
26
|
+
PACK_UCHAR_UINT32 = 'CN'.freeze
|
27
|
+
PACK_CHAR_UINT16_UINT32 = 'cnN'.freeze
|
28
|
+
|
29
|
+
PACK_32BIT_FLOAT = 'f'.freeze
|
30
|
+
PACK_64BIT_FLOAT = 'd'.freeze
|
31
|
+
|
32
|
+
|
31
33
|
|
32
34
|
# @return [Array] Collection of subclasses of AMQ::Protocol::Class.
|
33
35
|
def self.classes
|
@@ -168,8 +170,9 @@ module AMQ
|
|
168
170
|
VALUE = 541
|
169
171
|
end
|
170
172
|
|
171
|
-
|
172
|
-
#
|
173
|
+
|
174
|
+
# We don't instantiate the following classes,
|
175
|
+
# as we don't actually need any per-instance state.
|
173
176
|
# Also, this is pretty low-level functionality,
|
174
177
|
# hence it should have a reasonable performance.
|
175
178
|
# As everyone knows, garbage collector in MRI performs
|
@@ -177,10 +180,10 @@ module AMQ
|
|
177
180
|
# not creating any objects, but only use class as
|
178
181
|
# a struct. Creating classes is quite expensive though,
|
179
182
|
# but here the inheritance comes handy and mainly
|
180
|
-
# as we can
|
181
|
-
# we can
|
183
|
+
# as we can't simply make a reference to a function,
|
184
|
+
# we can't use a hash or an object. I've been also
|
182
185
|
# considering to have just a bunch of methods, but
|
183
|
-
# here
|
186
|
+
# here's the problem, that after we'd require this file,
|
184
187
|
# all these methods would become global which would
|
185
188
|
# be a bad, bad thing to do.
|
186
189
|
class Class
|
@@ -248,11 +251,10 @@ module AMQ
|
|
248
251
|
|
249
252
|
# See https://dev.rabbitmq.com/wiki/Amqp091Errata#section_11
|
250
253
|
limit = frame_size - 8
|
251
|
-
limit_plus_1 = limit + 1
|
252
254
|
|
253
255
|
array = Array.new
|
254
256
|
while body
|
255
|
-
payload, body = body[0,
|
257
|
+
payload, body = body[0, limit], body[limit, body.length - limit]
|
256
258
|
# array << [0x03, payload]
|
257
259
|
array << BodyFrame.new(payload, channel)
|
258
260
|
end
|
@@ -278,6 +280,8 @@ module AMQ
|
|
278
280
|
@name = "connection"
|
279
281
|
@method_id = 10
|
280
282
|
|
283
|
+
|
284
|
+
|
281
285
|
class Start < Protocol::Method
|
282
286
|
@name = "connection.start"
|
283
287
|
@method_id = 10
|
@@ -317,6 +321,8 @@ module AMQ
|
|
317
321
|
def self.has_content?
|
318
322
|
false
|
319
323
|
end
|
324
|
+
|
325
|
+
|
320
326
|
end
|
321
327
|
|
322
328
|
class StartOk < Protocol::Method
|
@@ -325,15 +331,16 @@ module AMQ
|
|
325
331
|
@index = 0x000A000B # 10, 11, 655371
|
326
332
|
@packed_indexes = [10, 11].pack(PACK_UINT16_X2).freeze
|
327
333
|
|
334
|
+
|
328
335
|
def self.has_content?
|
329
336
|
false
|
330
337
|
end
|
331
338
|
|
332
339
|
# @return
|
333
|
-
# [
|
340
|
+
# [u'client_properties = nil', u"mechanism = u'PLAIN'", u'response = nil', u"locale = u'en_US'"]
|
334
341
|
def self.encode(client_properties, mechanism, response, locale)
|
335
342
|
channel = 0
|
336
|
-
buffer =
|
343
|
+
buffer = ''
|
337
344
|
buffer << @packed_indexes
|
338
345
|
buffer << AMQ::Protocol::Table.encode(client_properties)
|
339
346
|
buffer << mechanism.bytesize.chr
|
@@ -344,6 +351,7 @@ module AMQ
|
|
344
351
|
buffer << locale
|
345
352
|
MethodFrame.new(buffer, channel)
|
346
353
|
end
|
354
|
+
|
347
355
|
end
|
348
356
|
|
349
357
|
class Secure < Protocol::Method
|
@@ -370,6 +378,8 @@ module AMQ
|
|
370
378
|
def self.has_content?
|
371
379
|
false
|
372
380
|
end
|
381
|
+
|
382
|
+
|
373
383
|
end
|
374
384
|
|
375
385
|
class SecureOk < Protocol::Method
|
@@ -378,20 +388,22 @@ module AMQ
|
|
378
388
|
@index = 0x000A0015 # 10, 21, 655381
|
379
389
|
@packed_indexes = [10, 21].pack(PACK_UINT16_X2).freeze
|
380
390
|
|
391
|
+
|
381
392
|
def self.has_content?
|
382
393
|
false
|
383
394
|
end
|
384
395
|
|
385
396
|
# @return
|
386
|
-
# [
|
397
|
+
# [u'response = nil']
|
387
398
|
def self.encode(response)
|
388
399
|
channel = 0
|
389
|
-
buffer =
|
400
|
+
buffer = ''
|
390
401
|
buffer << @packed_indexes
|
391
402
|
buffer << [response.bytesize].pack(PACK_UINT32)
|
392
403
|
buffer << response
|
393
404
|
MethodFrame.new(buffer, channel)
|
394
405
|
end
|
406
|
+
|
395
407
|
end
|
396
408
|
|
397
409
|
class Tune < Protocol::Method
|
@@ -422,6 +434,8 @@ module AMQ
|
|
422
434
|
def self.has_content?
|
423
435
|
false
|
424
436
|
end
|
437
|
+
|
438
|
+
|
425
439
|
end
|
426
440
|
|
427
441
|
class TuneOk < Protocol::Method
|
@@ -430,21 +444,23 @@ module AMQ
|
|
430
444
|
@index = 0x000A001F # 10, 31, 655391
|
431
445
|
@packed_indexes = [10, 31].pack(PACK_UINT16_X2).freeze
|
432
446
|
|
447
|
+
|
433
448
|
def self.has_content?
|
434
449
|
false
|
435
450
|
end
|
436
451
|
|
437
452
|
# @return
|
438
|
-
# [
|
453
|
+
# [u'channel_max = false', u'frame_max = false', u'heartbeat = false']
|
439
454
|
def self.encode(channel_max, frame_max, heartbeat)
|
440
455
|
channel = 0
|
441
|
-
buffer =
|
456
|
+
buffer = ''
|
442
457
|
buffer << @packed_indexes
|
443
458
|
buffer << [channel_max].pack(PACK_UINT16)
|
444
459
|
buffer << [frame_max].pack(PACK_UINT32)
|
445
460
|
buffer << [heartbeat].pack(PACK_UINT16)
|
446
461
|
MethodFrame.new(buffer, channel)
|
447
462
|
end
|
463
|
+
|
448
464
|
end
|
449
465
|
|
450
466
|
class Open < Protocol::Method
|
@@ -453,17 +469,18 @@ module AMQ
|
|
453
469
|
@index = 0x000A0028 # 10, 40, 655400
|
454
470
|
@packed_indexes = [10, 40].pack(PACK_UINT16_X2).freeze
|
455
471
|
|
472
|
+
|
456
473
|
def self.has_content?
|
457
474
|
false
|
458
475
|
end
|
459
476
|
|
460
477
|
# @return
|
461
|
-
# ["virtual_host =
|
478
|
+
# [u"virtual_host = u'/'", u'capabilities = EMPTY_STRING', u'insist = false']
|
462
479
|
def self.encode(virtual_host)
|
463
480
|
capabilities = EMPTY_STRING
|
464
481
|
insist = false
|
465
482
|
channel = 0
|
466
|
-
buffer =
|
483
|
+
buffer = ''
|
467
484
|
buffer << @packed_indexes
|
468
485
|
buffer << virtual_host.bytesize.chr
|
469
486
|
buffer << virtual_host
|
@@ -474,6 +491,7 @@ module AMQ
|
|
474
491
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
475
492
|
MethodFrame.new(buffer, channel)
|
476
493
|
end
|
494
|
+
|
477
495
|
end
|
478
496
|
|
479
497
|
class OpenOk < Protocol::Method
|
@@ -500,6 +518,8 @@ module AMQ
|
|
500
518
|
def self.has_content?
|
501
519
|
false
|
502
520
|
end
|
521
|
+
|
522
|
+
|
503
523
|
end
|
504
524
|
|
505
525
|
class Close < Protocol::Method
|
@@ -537,10 +557,10 @@ module AMQ
|
|
537
557
|
end
|
538
558
|
|
539
559
|
# @return
|
540
|
-
# [
|
560
|
+
# [u'reply_code = nil', u'reply_text = EMPTY_STRING', u'class_id = nil', u'method_id = nil']
|
541
561
|
def self.encode(reply_code, reply_text, class_id, method_id)
|
542
562
|
channel = 0
|
543
|
-
buffer =
|
563
|
+
buffer = ''
|
544
564
|
buffer << @packed_indexes
|
545
565
|
buffer << [reply_code].pack(PACK_UINT16)
|
546
566
|
buffer << reply_text.bytesize.chr
|
@@ -549,6 +569,7 @@ module AMQ
|
|
549
569
|
buffer << [method_id].pack(PACK_UINT16)
|
550
570
|
MethodFrame.new(buffer, channel)
|
551
571
|
end
|
572
|
+
|
552
573
|
end
|
553
574
|
|
554
575
|
class CloseOk < Protocol::Method
|
@@ -574,36 +595,42 @@ module AMQ
|
|
574
595
|
# []
|
575
596
|
def self.encode()
|
576
597
|
channel = 0
|
577
|
-
buffer =
|
598
|
+
buffer = ''
|
578
599
|
buffer << @packed_indexes
|
579
600
|
MethodFrame.new(buffer, channel)
|
580
601
|
end
|
602
|
+
|
581
603
|
end
|
604
|
+
|
582
605
|
end
|
583
606
|
|
584
607
|
class Channel < Protocol::Class
|
585
608
|
@name = "channel"
|
586
609
|
@method_id = 20
|
587
610
|
|
611
|
+
|
612
|
+
|
588
613
|
class Open < Protocol::Method
|
589
614
|
@name = "channel.open"
|
590
615
|
@method_id = 10
|
591
616
|
@index = 0x0014000A # 20, 10, 1310730
|
592
617
|
@packed_indexes = [20, 10].pack(PACK_UINT16_X2).freeze
|
593
618
|
|
619
|
+
|
594
620
|
def self.has_content?
|
595
621
|
false
|
596
622
|
end
|
597
623
|
|
598
624
|
# @return
|
599
|
-
# [
|
625
|
+
# [u'out_of_band = EMPTY_STRING']
|
600
626
|
def self.encode(channel, out_of_band)
|
601
|
-
buffer =
|
627
|
+
buffer = ''
|
602
628
|
buffer << @packed_indexes
|
603
629
|
buffer << out_of_band.bytesize.chr
|
604
630
|
buffer << out_of_band
|
605
631
|
MethodFrame.new(buffer, channel)
|
606
632
|
end
|
633
|
+
|
607
634
|
end
|
608
635
|
|
609
636
|
class OpenOk < Protocol::Method
|
@@ -630,6 +657,8 @@ module AMQ
|
|
630
657
|
def self.has_content?
|
631
658
|
false
|
632
659
|
end
|
660
|
+
|
661
|
+
|
633
662
|
end
|
634
663
|
|
635
664
|
class Flow < Protocol::Method
|
@@ -657,15 +686,16 @@ module AMQ
|
|
657
686
|
end
|
658
687
|
|
659
688
|
# @return
|
660
|
-
# [
|
689
|
+
# [u'active = nil']
|
661
690
|
def self.encode(channel, active)
|
662
|
-
buffer =
|
691
|
+
buffer = ''
|
663
692
|
buffer << @packed_indexes
|
664
693
|
bit_buffer = 0
|
665
694
|
bit_buffer = bit_buffer | (1 << 0) if active
|
666
695
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
667
696
|
MethodFrame.new(buffer, channel)
|
668
697
|
end
|
698
|
+
|
669
699
|
end
|
670
700
|
|
671
701
|
class FlowOk < Protocol::Method
|
@@ -693,15 +723,16 @@ module AMQ
|
|
693
723
|
end
|
694
724
|
|
695
725
|
# @return
|
696
|
-
# [
|
726
|
+
# [u'active = nil']
|
697
727
|
def self.encode(channel, active)
|
698
|
-
buffer =
|
728
|
+
buffer = ''
|
699
729
|
buffer << @packed_indexes
|
700
730
|
bit_buffer = 0
|
701
731
|
bit_buffer = bit_buffer | (1 << 0) if active
|
702
732
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
703
733
|
MethodFrame.new(buffer, channel)
|
704
734
|
end
|
735
|
+
|
705
736
|
end
|
706
737
|
|
707
738
|
class Close < Protocol::Method
|
@@ -739,9 +770,9 @@ module AMQ
|
|
739
770
|
end
|
740
771
|
|
741
772
|
# @return
|
742
|
-
# [
|
773
|
+
# [u'reply_code = nil', u'reply_text = EMPTY_STRING', u'class_id = nil', u'method_id = nil']
|
743
774
|
def self.encode(channel, reply_code, reply_text, class_id, method_id)
|
744
|
-
buffer =
|
775
|
+
buffer = ''
|
745
776
|
buffer << @packed_indexes
|
746
777
|
buffer << [reply_code].pack(PACK_UINT16)
|
747
778
|
buffer << reply_text.bytesize.chr
|
@@ -750,6 +781,7 @@ module AMQ
|
|
750
781
|
buffer << [method_id].pack(PACK_UINT16)
|
751
782
|
MethodFrame.new(buffer, channel)
|
752
783
|
end
|
784
|
+
|
753
785
|
end
|
754
786
|
|
755
787
|
class CloseOk < Protocol::Method
|
@@ -774,32 +806,37 @@ module AMQ
|
|
774
806
|
# @return
|
775
807
|
# []
|
776
808
|
def self.encode(channel)
|
777
|
-
buffer =
|
809
|
+
buffer = ''
|
778
810
|
buffer << @packed_indexes
|
779
811
|
MethodFrame.new(buffer, channel)
|
780
812
|
end
|
813
|
+
|
781
814
|
end
|
815
|
+
|
782
816
|
end
|
783
817
|
|
784
818
|
class Exchange < Protocol::Class
|
785
819
|
@name = "exchange"
|
786
820
|
@method_id = 40
|
787
821
|
|
822
|
+
|
823
|
+
|
788
824
|
class Declare < Protocol::Method
|
789
825
|
@name = "exchange.declare"
|
790
826
|
@method_id = 10
|
791
827
|
@index = 0x0028000A # 40, 10, 2621450
|
792
828
|
@packed_indexes = [40, 10].pack(PACK_UINT16_X2).freeze
|
793
829
|
|
830
|
+
|
794
831
|
def self.has_content?
|
795
832
|
false
|
796
833
|
end
|
797
834
|
|
798
835
|
# @return
|
799
|
-
# [
|
836
|
+
# [u'ticket = 0', u'exchange = nil', u"type = u'direct'", u'passive = false', u'durable = false', u'auto_delete = false', u'internal = false', u'nowait = false', u'arguments = {}']
|
800
837
|
def self.encode(channel, exchange, type, passive, durable, auto_delete, internal, nowait, arguments)
|
801
838
|
ticket = 0
|
802
|
-
buffer =
|
839
|
+
buffer = ''
|
803
840
|
buffer << @packed_indexes
|
804
841
|
buffer << [ticket].pack(PACK_UINT16)
|
805
842
|
buffer << exchange.bytesize.chr
|
@@ -816,6 +853,7 @@ module AMQ
|
|
816
853
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
817
854
|
MethodFrame.new(buffer, channel)
|
818
855
|
end
|
856
|
+
|
819
857
|
end
|
820
858
|
|
821
859
|
class DeclareOk < Protocol::Method
|
@@ -836,6 +874,8 @@ module AMQ
|
|
836
874
|
def self.has_content?
|
837
875
|
false
|
838
876
|
end
|
877
|
+
|
878
|
+
|
839
879
|
end
|
840
880
|
|
841
881
|
class Delete < Protocol::Method
|
@@ -844,15 +884,16 @@ module AMQ
|
|
844
884
|
@index = 0x00280014 # 40, 20, 2621460
|
845
885
|
@packed_indexes = [40, 20].pack(PACK_UINT16_X2).freeze
|
846
886
|
|
887
|
+
|
847
888
|
def self.has_content?
|
848
889
|
false
|
849
890
|
end
|
850
891
|
|
851
892
|
# @return
|
852
|
-
# [
|
893
|
+
# [u'ticket = 0', u'exchange = nil', u'if_unused = false', u'nowait = false']
|
853
894
|
def self.encode(channel, exchange, if_unused, nowait)
|
854
895
|
ticket = 0
|
855
|
-
buffer =
|
896
|
+
buffer = ''
|
856
897
|
buffer << @packed_indexes
|
857
898
|
buffer << [ticket].pack(PACK_UINT16)
|
858
899
|
buffer << exchange.bytesize.chr
|
@@ -863,6 +904,7 @@ module AMQ
|
|
863
904
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
864
905
|
MethodFrame.new(buffer, channel)
|
865
906
|
end
|
907
|
+
|
866
908
|
end
|
867
909
|
|
868
910
|
class DeleteOk < Protocol::Method
|
@@ -883,6 +925,8 @@ module AMQ
|
|
883
925
|
def self.has_content?
|
884
926
|
false
|
885
927
|
end
|
928
|
+
|
929
|
+
|
886
930
|
end
|
887
931
|
|
888
932
|
class Bind < Protocol::Method
|
@@ -891,15 +935,16 @@ module AMQ
|
|
891
935
|
@index = 0x0028001E # 40, 30, 2621470
|
892
936
|
@packed_indexes = [40, 30].pack(PACK_UINT16_X2).freeze
|
893
937
|
|
938
|
+
|
894
939
|
def self.has_content?
|
895
940
|
false
|
896
941
|
end
|
897
942
|
|
898
943
|
# @return
|
899
|
-
# [
|
944
|
+
# [u'ticket = 0', u'destination = nil', u'source = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
900
945
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
901
946
|
ticket = 0
|
902
|
-
buffer =
|
947
|
+
buffer = ''
|
903
948
|
buffer << @packed_indexes
|
904
949
|
buffer << [ticket].pack(PACK_UINT16)
|
905
950
|
buffer << destination.bytesize.chr
|
@@ -914,6 +959,7 @@ module AMQ
|
|
914
959
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
915
960
|
MethodFrame.new(buffer, channel)
|
916
961
|
end
|
962
|
+
|
917
963
|
end
|
918
964
|
|
919
965
|
class BindOk < Protocol::Method
|
@@ -934,6 +980,8 @@ module AMQ
|
|
934
980
|
def self.has_content?
|
935
981
|
false
|
936
982
|
end
|
983
|
+
|
984
|
+
|
937
985
|
end
|
938
986
|
|
939
987
|
class Unbind < Protocol::Method
|
@@ -942,15 +990,16 @@ module AMQ
|
|
942
990
|
@index = 0x00280028 # 40, 40, 2621480
|
943
991
|
@packed_indexes = [40, 40].pack(PACK_UINT16_X2).freeze
|
944
992
|
|
993
|
+
|
945
994
|
def self.has_content?
|
946
995
|
false
|
947
996
|
end
|
948
997
|
|
949
998
|
# @return
|
950
|
-
# [
|
999
|
+
# [u'ticket = 0', u'destination = nil', u'source = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
951
1000
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
952
1001
|
ticket = 0
|
953
|
-
buffer =
|
1002
|
+
buffer = ''
|
954
1003
|
buffer << @packed_indexes
|
955
1004
|
buffer << [ticket].pack(PACK_UINT16)
|
956
1005
|
buffer << destination.bytesize.chr
|
@@ -965,6 +1014,7 @@ module AMQ
|
|
965
1014
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
966
1015
|
MethodFrame.new(buffer, channel)
|
967
1016
|
end
|
1017
|
+
|
968
1018
|
end
|
969
1019
|
|
970
1020
|
class UnbindOk < Protocol::Method
|
@@ -985,28 +1035,34 @@ module AMQ
|
|
985
1035
|
def self.has_content?
|
986
1036
|
false
|
987
1037
|
end
|
1038
|
+
|
1039
|
+
|
988
1040
|
end
|
1041
|
+
|
989
1042
|
end
|
990
1043
|
|
991
1044
|
class Queue < Protocol::Class
|
992
1045
|
@name = "queue"
|
993
1046
|
@method_id = 50
|
994
1047
|
|
1048
|
+
|
1049
|
+
|
995
1050
|
class Declare < Protocol::Method
|
996
1051
|
@name = "queue.declare"
|
997
1052
|
@method_id = 10
|
998
1053
|
@index = 0x0032000A # 50, 10, 3276810
|
999
1054
|
@packed_indexes = [50, 10].pack(PACK_UINT16_X2).freeze
|
1000
1055
|
|
1056
|
+
|
1001
1057
|
def self.has_content?
|
1002
1058
|
false
|
1003
1059
|
end
|
1004
1060
|
|
1005
1061
|
# @return
|
1006
|
-
# [
|
1062
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'passive = false', u'durable = false', u'exclusive = false', u'auto_delete = false', u'nowait = false', u'arguments = {}']
|
1007
1063
|
def self.encode(channel, queue, passive, durable, exclusive, auto_delete, nowait, arguments)
|
1008
1064
|
ticket = 0
|
1009
|
-
buffer =
|
1065
|
+
buffer = ''
|
1010
1066
|
buffer << @packed_indexes
|
1011
1067
|
buffer << [ticket].pack(PACK_UINT16)
|
1012
1068
|
buffer << queue.bytesize.chr
|
@@ -1021,6 +1077,7 @@ module AMQ
|
|
1021
1077
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1022
1078
|
MethodFrame.new(buffer, channel)
|
1023
1079
|
end
|
1080
|
+
|
1024
1081
|
end
|
1025
1082
|
|
1026
1083
|
class DeclareOk < Protocol::Method
|
@@ -1053,6 +1110,8 @@ module AMQ
|
|
1053
1110
|
def self.has_content?
|
1054
1111
|
false
|
1055
1112
|
end
|
1113
|
+
|
1114
|
+
|
1056
1115
|
end
|
1057
1116
|
|
1058
1117
|
class Bind < Protocol::Method
|
@@ -1061,15 +1120,16 @@ module AMQ
|
|
1061
1120
|
@index = 0x00320014 # 50, 20, 3276820
|
1062
1121
|
@packed_indexes = [50, 20].pack(PACK_UINT16_X2).freeze
|
1063
1122
|
|
1123
|
+
|
1064
1124
|
def self.has_content?
|
1065
1125
|
false
|
1066
1126
|
end
|
1067
1127
|
|
1068
1128
|
# @return
|
1069
|
-
# [
|
1129
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'exchange = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
1070
1130
|
def self.encode(channel, queue, exchange, routing_key, nowait, arguments)
|
1071
1131
|
ticket = 0
|
1072
|
-
buffer =
|
1132
|
+
buffer = ''
|
1073
1133
|
buffer << @packed_indexes
|
1074
1134
|
buffer << [ticket].pack(PACK_UINT16)
|
1075
1135
|
buffer << queue.bytesize.chr
|
@@ -1084,6 +1144,7 @@ module AMQ
|
|
1084
1144
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1085
1145
|
MethodFrame.new(buffer, channel)
|
1086
1146
|
end
|
1147
|
+
|
1087
1148
|
end
|
1088
1149
|
|
1089
1150
|
class BindOk < Protocol::Method
|
@@ -1104,6 +1165,8 @@ module AMQ
|
|
1104
1165
|
def self.has_content?
|
1105
1166
|
false
|
1106
1167
|
end
|
1168
|
+
|
1169
|
+
|
1107
1170
|
end
|
1108
1171
|
|
1109
1172
|
class Purge < Protocol::Method
|
@@ -1112,15 +1175,16 @@ module AMQ
|
|
1112
1175
|
@index = 0x0032001E # 50, 30, 3276830
|
1113
1176
|
@packed_indexes = [50, 30].pack(PACK_UINT16_X2).freeze
|
1114
1177
|
|
1178
|
+
|
1115
1179
|
def self.has_content?
|
1116
1180
|
false
|
1117
1181
|
end
|
1118
1182
|
|
1119
1183
|
# @return
|
1120
|
-
# [
|
1184
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'nowait = false']
|
1121
1185
|
def self.encode(channel, queue, nowait)
|
1122
1186
|
ticket = 0
|
1123
|
-
buffer =
|
1187
|
+
buffer = ''
|
1124
1188
|
buffer << @packed_indexes
|
1125
1189
|
buffer << [ticket].pack(PACK_UINT16)
|
1126
1190
|
buffer << queue.bytesize.chr
|
@@ -1130,6 +1194,7 @@ module AMQ
|
|
1130
1194
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1131
1195
|
MethodFrame.new(buffer, channel)
|
1132
1196
|
end
|
1197
|
+
|
1133
1198
|
end
|
1134
1199
|
|
1135
1200
|
class PurgeOk < Protocol::Method
|
@@ -1154,6 +1219,8 @@ module AMQ
|
|
1154
1219
|
def self.has_content?
|
1155
1220
|
false
|
1156
1221
|
end
|
1222
|
+
|
1223
|
+
|
1157
1224
|
end
|
1158
1225
|
|
1159
1226
|
class Delete < Protocol::Method
|
@@ -1162,15 +1229,16 @@ module AMQ
|
|
1162
1229
|
@index = 0x00320028 # 50, 40, 3276840
|
1163
1230
|
@packed_indexes = [50, 40].pack(PACK_UINT16_X2).freeze
|
1164
1231
|
|
1232
|
+
|
1165
1233
|
def self.has_content?
|
1166
1234
|
false
|
1167
1235
|
end
|
1168
1236
|
|
1169
1237
|
# @return
|
1170
|
-
# [
|
1238
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'if_unused = false', u'if_empty = false', u'nowait = false']
|
1171
1239
|
def self.encode(channel, queue, if_unused, if_empty, nowait)
|
1172
1240
|
ticket = 0
|
1173
|
-
buffer =
|
1241
|
+
buffer = ''
|
1174
1242
|
buffer << @packed_indexes
|
1175
1243
|
buffer << [ticket].pack(PACK_UINT16)
|
1176
1244
|
buffer << queue.bytesize.chr
|
@@ -1182,6 +1250,7 @@ module AMQ
|
|
1182
1250
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1183
1251
|
MethodFrame.new(buffer, channel)
|
1184
1252
|
end
|
1253
|
+
|
1185
1254
|
end
|
1186
1255
|
|
1187
1256
|
class DeleteOk < Protocol::Method
|
@@ -1206,6 +1275,8 @@ module AMQ
|
|
1206
1275
|
def self.has_content?
|
1207
1276
|
false
|
1208
1277
|
end
|
1278
|
+
|
1279
|
+
|
1209
1280
|
end
|
1210
1281
|
|
1211
1282
|
class Unbind < Protocol::Method
|
@@ -1214,15 +1285,16 @@ module AMQ
|
|
1214
1285
|
@index = 0x00320032 # 50, 50, 3276850
|
1215
1286
|
@packed_indexes = [50, 50].pack(PACK_UINT16_X2).freeze
|
1216
1287
|
|
1288
|
+
|
1217
1289
|
def self.has_content?
|
1218
1290
|
false
|
1219
1291
|
end
|
1220
1292
|
|
1221
1293
|
# @return
|
1222
|
-
# [
|
1294
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'exchange = nil', u'routing_key = EMPTY_STRING', u'arguments = {}']
|
1223
1295
|
def self.encode(channel, queue, exchange, routing_key, arguments)
|
1224
1296
|
ticket = 0
|
1225
|
-
buffer =
|
1297
|
+
buffer = ''
|
1226
1298
|
buffer << @packed_indexes
|
1227
1299
|
buffer << [ticket].pack(PACK_UINT16)
|
1228
1300
|
buffer << queue.bytesize.chr
|
@@ -1234,6 +1306,7 @@ module AMQ
|
|
1234
1306
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1235
1307
|
MethodFrame.new(buffer, channel)
|
1236
1308
|
end
|
1309
|
+
|
1237
1310
|
end
|
1238
1311
|
|
1239
1312
|
class UnbindOk < Protocol::Method
|
@@ -1254,7 +1327,10 @@ module AMQ
|
|
1254
1327
|
def self.has_content?
|
1255
1328
|
false
|
1256
1329
|
end
|
1330
|
+
|
1331
|
+
|
1257
1332
|
end
|
1333
|
+
|
1258
1334
|
end
|
1259
1335
|
|
1260
1336
|
class Basic < Protocol::Class
|
@@ -1280,7 +1356,7 @@ module AMQ
|
|
1280
1356
|
|
1281
1357
|
# 1 << 15
|
1282
1358
|
def self.encode_content_type(value)
|
1283
|
-
buffer =
|
1359
|
+
buffer = ''
|
1284
1360
|
buffer << value.bytesize.chr
|
1285
1361
|
buffer << value
|
1286
1362
|
[0, 0x8000, buffer]
|
@@ -1288,7 +1364,7 @@ module AMQ
|
|
1288
1364
|
|
1289
1365
|
# 1 << 14
|
1290
1366
|
def self.encode_content_encoding(value)
|
1291
|
-
buffer =
|
1367
|
+
buffer = ''
|
1292
1368
|
buffer << value.bytesize.chr
|
1293
1369
|
buffer << value
|
1294
1370
|
[1, 0x4000, buffer]
|
@@ -1296,28 +1372,28 @@ module AMQ
|
|
1296
1372
|
|
1297
1373
|
# 1 << 13
|
1298
1374
|
def self.encode_headers(value)
|
1299
|
-
buffer =
|
1375
|
+
buffer = ''
|
1300
1376
|
buffer << AMQ::Protocol::Table.encode(value)
|
1301
1377
|
[2, 0x2000, buffer]
|
1302
1378
|
end
|
1303
1379
|
|
1304
1380
|
# 1 << 12
|
1305
1381
|
def self.encode_delivery_mode(value)
|
1306
|
-
buffer =
|
1382
|
+
buffer = ''
|
1307
1383
|
buffer << [value].pack(PACK_CHAR)
|
1308
1384
|
[3, 0x1000, buffer]
|
1309
1385
|
end
|
1310
1386
|
|
1311
1387
|
# 1 << 11
|
1312
1388
|
def self.encode_priority(value)
|
1313
|
-
buffer =
|
1389
|
+
buffer = ''
|
1314
1390
|
buffer << [value].pack(PACK_CHAR)
|
1315
1391
|
[4, 0x0800, buffer]
|
1316
1392
|
end
|
1317
1393
|
|
1318
1394
|
# 1 << 10
|
1319
1395
|
def self.encode_correlation_id(value)
|
1320
|
-
buffer =
|
1396
|
+
buffer = ''
|
1321
1397
|
buffer << value.bytesize.chr
|
1322
1398
|
buffer << value
|
1323
1399
|
[5, 0x0400, buffer]
|
@@ -1325,7 +1401,7 @@ module AMQ
|
|
1325
1401
|
|
1326
1402
|
# 1 << 9
|
1327
1403
|
def self.encode_reply_to(value)
|
1328
|
-
buffer =
|
1404
|
+
buffer = ''
|
1329
1405
|
buffer << value.bytesize.chr
|
1330
1406
|
buffer << value
|
1331
1407
|
[6, 0x0200, buffer]
|
@@ -1333,7 +1409,7 @@ module AMQ
|
|
1333
1409
|
|
1334
1410
|
# 1 << 8
|
1335
1411
|
def self.encode_expiration(value)
|
1336
|
-
buffer =
|
1412
|
+
buffer = ''
|
1337
1413
|
buffer << value.bytesize.chr
|
1338
1414
|
buffer << value
|
1339
1415
|
[7, 0x0100, buffer]
|
@@ -1341,7 +1417,7 @@ module AMQ
|
|
1341
1417
|
|
1342
1418
|
# 1 << 7
|
1343
1419
|
def self.encode_message_id(value)
|
1344
|
-
buffer =
|
1420
|
+
buffer = ''
|
1345
1421
|
buffer << value.bytesize.chr
|
1346
1422
|
buffer << value
|
1347
1423
|
[8, 0x0080, buffer]
|
@@ -1349,14 +1425,14 @@ module AMQ
|
|
1349
1425
|
|
1350
1426
|
# 1 << 6
|
1351
1427
|
def self.encode_timestamp(value)
|
1352
|
-
buffer =
|
1428
|
+
buffer = ''
|
1353
1429
|
buffer << AMQ::Hacks.pack_64_big_endian(value)
|
1354
1430
|
[9, 0x0040, buffer]
|
1355
1431
|
end
|
1356
1432
|
|
1357
1433
|
# 1 << 5
|
1358
1434
|
def self.encode_type(value)
|
1359
|
-
buffer =
|
1435
|
+
buffer = ''
|
1360
1436
|
buffer << value.bytesize.chr
|
1361
1437
|
buffer << value
|
1362
1438
|
[10, 0x0020, buffer]
|
@@ -1364,7 +1440,7 @@ module AMQ
|
|
1364
1440
|
|
1365
1441
|
# 1 << 4
|
1366
1442
|
def self.encode_user_id(value)
|
1367
|
-
buffer =
|
1443
|
+
buffer = ''
|
1368
1444
|
buffer << value.bytesize.chr
|
1369
1445
|
buffer << value
|
1370
1446
|
[11, 0x0010, buffer]
|
@@ -1372,7 +1448,7 @@ module AMQ
|
|
1372
1448
|
|
1373
1449
|
# 1 << 3
|
1374
1450
|
def self.encode_app_id(value)
|
1375
|
-
buffer =
|
1451
|
+
buffer = ''
|
1376
1452
|
buffer << value.bytesize.chr
|
1377
1453
|
buffer << value
|
1378
1454
|
[12, 0x0008, buffer]
|
@@ -1380,12 +1456,14 @@ module AMQ
|
|
1380
1456
|
|
1381
1457
|
# 1 << 2
|
1382
1458
|
def self.encode_cluster_id(value)
|
1383
|
-
buffer =
|
1459
|
+
buffer = ''
|
1384
1460
|
buffer << value.bytesize.chr
|
1385
1461
|
buffer << value
|
1386
1462
|
[13, 0x0004, buffer]
|
1387
1463
|
end
|
1388
1464
|
|
1465
|
+
|
1466
|
+
|
1389
1467
|
def self.encode_properties(body_size, properties)
|
1390
1468
|
pieces, flags = [], 0
|
1391
1469
|
|
@@ -1395,7 +1473,7 @@ module AMQ
|
|
1395
1473
|
pieces[i] = result
|
1396
1474
|
end
|
1397
1475
|
|
1398
|
-
# result = [60, 0, body_size, flags].pack(
|
1476
|
+
# result = [60, 0, body_size, flags].pack('n2Qn')
|
1399
1477
|
result = [60, 0].pack(PACK_UINT16_X2)
|
1400
1478
|
result += AMQ::Hacks.pack_64_big_endian(body_size)
|
1401
1479
|
result += [flags].pack(PACK_UINT16)
|
@@ -1437,7 +1515,7 @@ module AMQ
|
|
1437
1515
|
0x0004 => :shortstr,
|
1438
1516
|
}
|
1439
1517
|
|
1440
|
-
# Hash doesn
|
1518
|
+
# Hash doesn't give any guarantees on keys order, we will do it in a
|
1441
1519
|
# straightforward way
|
1442
1520
|
DECODE_PROPERTIES_KEYS = [
|
1443
1521
|
0x8000,
|
@@ -1495,14 +1573,15 @@ module AMQ
|
|
1495
1573
|
@index = 0x003C000A # 60, 10, 3932170
|
1496
1574
|
@packed_indexes = [60, 10].pack(PACK_UINT16_X2).freeze
|
1497
1575
|
|
1576
|
+
|
1498
1577
|
def self.has_content?
|
1499
1578
|
false
|
1500
1579
|
end
|
1501
1580
|
|
1502
1581
|
# @return
|
1503
|
-
# [
|
1582
|
+
# [u'prefetch_size = false', u'prefetch_count = false', u'global = false']
|
1504
1583
|
def self.encode(channel, prefetch_size, prefetch_count, global)
|
1505
|
-
buffer =
|
1584
|
+
buffer = ''
|
1506
1585
|
buffer << @packed_indexes
|
1507
1586
|
buffer << [prefetch_size].pack(PACK_UINT32)
|
1508
1587
|
buffer << [prefetch_count].pack(PACK_UINT16)
|
@@ -1511,6 +1590,7 @@ module AMQ
|
|
1511
1590
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1512
1591
|
MethodFrame.new(buffer, channel)
|
1513
1592
|
end
|
1593
|
+
|
1514
1594
|
end
|
1515
1595
|
|
1516
1596
|
class QosOk < Protocol::Method
|
@@ -1531,6 +1611,8 @@ module AMQ
|
|
1531
1611
|
def self.has_content?
|
1532
1612
|
false
|
1533
1613
|
end
|
1614
|
+
|
1615
|
+
|
1534
1616
|
end
|
1535
1617
|
|
1536
1618
|
class Consume < Protocol::Method
|
@@ -1539,15 +1621,16 @@ module AMQ
|
|
1539
1621
|
@index = 0x003C0014 # 60, 20, 3932180
|
1540
1622
|
@packed_indexes = [60, 20].pack(PACK_UINT16_X2).freeze
|
1541
1623
|
|
1624
|
+
|
1542
1625
|
def self.has_content?
|
1543
1626
|
false
|
1544
1627
|
end
|
1545
1628
|
|
1546
1629
|
# @return
|
1547
|
-
# [
|
1630
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'consumer_tag = EMPTY_STRING', u'no_local = false', u'no_ack = false', u'exclusive = false', u'nowait = false', u'arguments = {}']
|
1548
1631
|
def self.encode(channel, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments)
|
1549
1632
|
ticket = 0
|
1550
|
-
buffer =
|
1633
|
+
buffer = ''
|
1551
1634
|
buffer << @packed_indexes
|
1552
1635
|
buffer << [ticket].pack(PACK_UINT16)
|
1553
1636
|
buffer << queue.bytesize.chr
|
@@ -1563,6 +1646,7 @@ module AMQ
|
|
1563
1646
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1564
1647
|
MethodFrame.new(buffer, channel)
|
1565
1648
|
end
|
1649
|
+
|
1566
1650
|
end
|
1567
1651
|
|
1568
1652
|
class ConsumeOk < Protocol::Method
|
@@ -1589,6 +1673,8 @@ module AMQ
|
|
1589
1673
|
def self.has_content?
|
1590
1674
|
false
|
1591
1675
|
end
|
1676
|
+
|
1677
|
+
|
1592
1678
|
end
|
1593
1679
|
|
1594
1680
|
class Cancel < Protocol::Method
|
@@ -1597,14 +1683,15 @@ module AMQ
|
|
1597
1683
|
@index = 0x003C001E # 60, 30, 3932190
|
1598
1684
|
@packed_indexes = [60, 30].pack(PACK_UINT16_X2).freeze
|
1599
1685
|
|
1686
|
+
|
1600
1687
|
def self.has_content?
|
1601
1688
|
false
|
1602
1689
|
end
|
1603
1690
|
|
1604
1691
|
# @return
|
1605
|
-
# [
|
1692
|
+
# [u'consumer_tag = nil', u'nowait = false']
|
1606
1693
|
def self.encode(channel, consumer_tag, nowait)
|
1607
|
-
buffer =
|
1694
|
+
buffer = ''
|
1608
1695
|
buffer << @packed_indexes
|
1609
1696
|
buffer << consumer_tag.bytesize.chr
|
1610
1697
|
buffer << consumer_tag
|
@@ -1613,6 +1700,7 @@ module AMQ
|
|
1613
1700
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1614
1701
|
MethodFrame.new(buffer, channel)
|
1615
1702
|
end
|
1703
|
+
|
1616
1704
|
end
|
1617
1705
|
|
1618
1706
|
class CancelOk < Protocol::Method
|
@@ -1639,6 +1727,8 @@ module AMQ
|
|
1639
1727
|
def self.has_content?
|
1640
1728
|
false
|
1641
1729
|
end
|
1730
|
+
|
1731
|
+
|
1642
1732
|
end
|
1643
1733
|
|
1644
1734
|
class Publish < Protocol::Method
|
@@ -1647,15 +1737,16 @@ module AMQ
|
|
1647
1737
|
@index = 0x003C0028 # 60, 40, 3932200
|
1648
1738
|
@packed_indexes = [60, 40].pack(PACK_UINT16_X2).freeze
|
1649
1739
|
|
1740
|
+
|
1650
1741
|
def self.has_content?
|
1651
1742
|
true
|
1652
1743
|
end
|
1653
1744
|
|
1654
1745
|
# @return
|
1655
|
-
# [
|
1746
|
+
# [u'ticket = 0', u'exchange = EMPTY_STRING', u'routing_key = EMPTY_STRING', u'mandatory = false', u'immediate = false', 'user_headers = nil', 'payload = ""', 'frame_size = nil']
|
1656
1747
|
def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size)
|
1657
1748
|
ticket = 0
|
1658
|
-
buffer =
|
1749
|
+
buffer = ''
|
1659
1750
|
buffer << @packed_indexes
|
1660
1751
|
buffer << [ticket].pack(PACK_UINT16)
|
1661
1752
|
buffer << exchange.bytesize.chr
|
@@ -1676,6 +1767,7 @@ module AMQ
|
|
1676
1767
|
frames << HeaderFrame.new(properties_payload, channel)
|
1677
1768
|
frames + self.encode_body(payload, channel, frame_size)
|
1678
1769
|
end
|
1770
|
+
|
1679
1771
|
end
|
1680
1772
|
|
1681
1773
|
class Return < Protocol::Method
|
@@ -1715,6 +1807,8 @@ module AMQ
|
|
1715
1807
|
def self.has_content?
|
1716
1808
|
true
|
1717
1809
|
end
|
1810
|
+
|
1811
|
+
|
1718
1812
|
end
|
1719
1813
|
|
1720
1814
|
class Deliver < Protocol::Method
|
@@ -1758,6 +1852,8 @@ module AMQ
|
|
1758
1852
|
def self.has_content?
|
1759
1853
|
true
|
1760
1854
|
end
|
1855
|
+
|
1856
|
+
|
1761
1857
|
end
|
1762
1858
|
|
1763
1859
|
class Get < Protocol::Method
|
@@ -1766,15 +1862,16 @@ module AMQ
|
|
1766
1862
|
@index = 0x003C0046 # 60, 70, 3932230
|
1767
1863
|
@packed_indexes = [60, 70].pack(PACK_UINT16_X2).freeze
|
1768
1864
|
|
1865
|
+
|
1769
1866
|
def self.has_content?
|
1770
1867
|
false
|
1771
1868
|
end
|
1772
1869
|
|
1773
1870
|
# @return
|
1774
|
-
# [
|
1871
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'no_ack = false']
|
1775
1872
|
def self.encode(channel, queue, no_ack)
|
1776
1873
|
ticket = 0
|
1777
|
-
buffer =
|
1874
|
+
buffer = ''
|
1778
1875
|
buffer << @packed_indexes
|
1779
1876
|
buffer << [ticket].pack(PACK_UINT16)
|
1780
1877
|
buffer << queue.bytesize.chr
|
@@ -1784,6 +1881,7 @@ module AMQ
|
|
1784
1881
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1785
1882
|
MethodFrame.new(buffer, channel)
|
1786
1883
|
end
|
1884
|
+
|
1787
1885
|
end
|
1788
1886
|
|
1789
1887
|
class GetOk < Protocol::Method
|
@@ -1825,6 +1923,8 @@ module AMQ
|
|
1825
1923
|
def self.has_content?
|
1826
1924
|
true
|
1827
1925
|
end
|
1926
|
+
|
1927
|
+
|
1828
1928
|
end
|
1829
1929
|
|
1830
1930
|
class GetEmpty < Protocol::Method
|
@@ -1851,6 +1951,8 @@ module AMQ
|
|
1851
1951
|
def self.has_content?
|
1852
1952
|
false
|
1853
1953
|
end
|
1954
|
+
|
1955
|
+
|
1854
1956
|
end
|
1855
1957
|
|
1856
1958
|
class Ack < Protocol::Method
|
@@ -1881,9 +1983,9 @@ module AMQ
|
|
1881
1983
|
end
|
1882
1984
|
|
1883
1985
|
# @return
|
1884
|
-
# [
|
1986
|
+
# [u'delivery_tag = false', u'multiple = false']
|
1885
1987
|
def self.encode(channel, delivery_tag, multiple)
|
1886
|
-
buffer =
|
1988
|
+
buffer = ''
|
1887
1989
|
buffer << @packed_indexes
|
1888
1990
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
1889
1991
|
bit_buffer = 0
|
@@ -1891,6 +1993,7 @@ module AMQ
|
|
1891
1993
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1892
1994
|
MethodFrame.new(buffer, channel)
|
1893
1995
|
end
|
1996
|
+
|
1894
1997
|
end
|
1895
1998
|
|
1896
1999
|
class Reject < Protocol::Method
|
@@ -1899,14 +2002,15 @@ module AMQ
|
|
1899
2002
|
@index = 0x003C005A # 60, 90, 3932250
|
1900
2003
|
@packed_indexes = [60, 90].pack(PACK_UINT16_X2).freeze
|
1901
2004
|
|
2005
|
+
|
1902
2006
|
def self.has_content?
|
1903
2007
|
false
|
1904
2008
|
end
|
1905
2009
|
|
1906
2010
|
# @return
|
1907
|
-
# [
|
2011
|
+
# [u'delivery_tag = nil', u'requeue = true']
|
1908
2012
|
def self.encode(channel, delivery_tag, requeue)
|
1909
|
-
buffer =
|
2013
|
+
buffer = ''
|
1910
2014
|
buffer << @packed_indexes
|
1911
2015
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
1912
2016
|
bit_buffer = 0
|
@@ -1914,6 +2018,7 @@ module AMQ
|
|
1914
2018
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1915
2019
|
MethodFrame.new(buffer, channel)
|
1916
2020
|
end
|
2021
|
+
|
1917
2022
|
end
|
1918
2023
|
|
1919
2024
|
class RecoverAsync < Protocol::Method
|
@@ -1922,20 +2027,22 @@ module AMQ
|
|
1922
2027
|
@index = 0x003C0064 # 60, 100, 3932260
|
1923
2028
|
@packed_indexes = [60, 100].pack(PACK_UINT16_X2).freeze
|
1924
2029
|
|
2030
|
+
|
1925
2031
|
def self.has_content?
|
1926
2032
|
false
|
1927
2033
|
end
|
1928
2034
|
|
1929
2035
|
# @return
|
1930
|
-
# [
|
2036
|
+
# [u'requeue = false']
|
1931
2037
|
def self.encode(channel, requeue)
|
1932
|
-
buffer =
|
2038
|
+
buffer = ''
|
1933
2039
|
buffer << @packed_indexes
|
1934
2040
|
bit_buffer = 0
|
1935
2041
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
1936
2042
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1937
2043
|
MethodFrame.new(buffer, channel)
|
1938
2044
|
end
|
2045
|
+
|
1939
2046
|
end
|
1940
2047
|
|
1941
2048
|
class Recover < Protocol::Method
|
@@ -1944,20 +2051,22 @@ module AMQ
|
|
1944
2051
|
@index = 0x003C006E # 60, 110, 3932270
|
1945
2052
|
@packed_indexes = [60, 110].pack(PACK_UINT16_X2).freeze
|
1946
2053
|
|
2054
|
+
|
1947
2055
|
def self.has_content?
|
1948
2056
|
false
|
1949
2057
|
end
|
1950
2058
|
|
1951
2059
|
# @return
|
1952
|
-
# [
|
2060
|
+
# [u'requeue = false']
|
1953
2061
|
def self.encode(channel, requeue)
|
1954
|
-
buffer =
|
2062
|
+
buffer = ''
|
1955
2063
|
buffer << @packed_indexes
|
1956
2064
|
bit_buffer = 0
|
1957
2065
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
1958
2066
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1959
2067
|
MethodFrame.new(buffer, channel)
|
1960
2068
|
end
|
2069
|
+
|
1961
2070
|
end
|
1962
2071
|
|
1963
2072
|
class RecoverOk < Protocol::Method
|
@@ -1978,6 +2087,8 @@ module AMQ
|
|
1978
2087
|
def self.has_content?
|
1979
2088
|
false
|
1980
2089
|
end
|
2090
|
+
|
2091
|
+
|
1981
2092
|
end
|
1982
2093
|
|
1983
2094
|
class Nack < Protocol::Method
|
@@ -2010,9 +2121,9 @@ module AMQ
|
|
2010
2121
|
end
|
2011
2122
|
|
2012
2123
|
# @return
|
2013
|
-
# [
|
2124
|
+
# [u'delivery_tag = false', u'multiple = false', u'requeue = true']
|
2014
2125
|
def self.encode(channel, delivery_tag, multiple, requeue)
|
2015
|
-
buffer =
|
2126
|
+
buffer = ''
|
2016
2127
|
buffer << @packed_indexes
|
2017
2128
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
2018
2129
|
bit_buffer = 0
|
@@ -2021,19 +2132,24 @@ module AMQ
|
|
2021
2132
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2022
2133
|
MethodFrame.new(buffer, channel)
|
2023
2134
|
end
|
2135
|
+
|
2024
2136
|
end
|
2137
|
+
|
2025
2138
|
end
|
2026
2139
|
|
2027
2140
|
class Tx < Protocol::Class
|
2028
2141
|
@name = "tx"
|
2029
2142
|
@method_id = 90
|
2030
2143
|
|
2144
|
+
|
2145
|
+
|
2031
2146
|
class Select < Protocol::Method
|
2032
2147
|
@name = "tx.select"
|
2033
2148
|
@method_id = 10
|
2034
2149
|
@index = 0x005A000A # 90, 10, 5898250
|
2035
2150
|
@packed_indexes = [90, 10].pack(PACK_UINT16_X2).freeze
|
2036
2151
|
|
2152
|
+
|
2037
2153
|
def self.has_content?
|
2038
2154
|
false
|
2039
2155
|
end
|
@@ -2041,10 +2157,11 @@ module AMQ
|
|
2041
2157
|
# @return
|
2042
2158
|
# []
|
2043
2159
|
def self.encode(channel)
|
2044
|
-
buffer =
|
2160
|
+
buffer = ''
|
2045
2161
|
buffer << @packed_indexes
|
2046
2162
|
MethodFrame.new(buffer, channel)
|
2047
2163
|
end
|
2164
|
+
|
2048
2165
|
end
|
2049
2166
|
|
2050
2167
|
class SelectOk < Protocol::Method
|
@@ -2065,6 +2182,8 @@ module AMQ
|
|
2065
2182
|
def self.has_content?
|
2066
2183
|
false
|
2067
2184
|
end
|
2185
|
+
|
2186
|
+
|
2068
2187
|
end
|
2069
2188
|
|
2070
2189
|
class Commit < Protocol::Method
|
@@ -2073,6 +2192,7 @@ module AMQ
|
|
2073
2192
|
@index = 0x005A0014 # 90, 20, 5898260
|
2074
2193
|
@packed_indexes = [90, 20].pack(PACK_UINT16_X2).freeze
|
2075
2194
|
|
2195
|
+
|
2076
2196
|
def self.has_content?
|
2077
2197
|
false
|
2078
2198
|
end
|
@@ -2080,10 +2200,11 @@ module AMQ
|
|
2080
2200
|
# @return
|
2081
2201
|
# []
|
2082
2202
|
def self.encode(channel)
|
2083
|
-
buffer =
|
2203
|
+
buffer = ''
|
2084
2204
|
buffer << @packed_indexes
|
2085
2205
|
MethodFrame.new(buffer, channel)
|
2086
2206
|
end
|
2207
|
+
|
2087
2208
|
end
|
2088
2209
|
|
2089
2210
|
class CommitOk < Protocol::Method
|
@@ -2104,6 +2225,8 @@ module AMQ
|
|
2104
2225
|
def self.has_content?
|
2105
2226
|
false
|
2106
2227
|
end
|
2228
|
+
|
2229
|
+
|
2107
2230
|
end
|
2108
2231
|
|
2109
2232
|
class Rollback < Protocol::Method
|
@@ -2112,6 +2235,7 @@ module AMQ
|
|
2112
2235
|
@index = 0x005A001E # 90, 30, 5898270
|
2113
2236
|
@packed_indexes = [90, 30].pack(PACK_UINT16_X2).freeze
|
2114
2237
|
|
2238
|
+
|
2115
2239
|
def self.has_content?
|
2116
2240
|
false
|
2117
2241
|
end
|
@@ -2119,10 +2243,11 @@ module AMQ
|
|
2119
2243
|
# @return
|
2120
2244
|
# []
|
2121
2245
|
def self.encode(channel)
|
2122
|
-
buffer =
|
2246
|
+
buffer = ''
|
2123
2247
|
buffer << @packed_indexes
|
2124
2248
|
MethodFrame.new(buffer, channel)
|
2125
2249
|
end
|
2250
|
+
|
2126
2251
|
end
|
2127
2252
|
|
2128
2253
|
class RollbackOk < Protocol::Method
|
@@ -2143,13 +2268,18 @@ module AMQ
|
|
2143
2268
|
def self.has_content?
|
2144
2269
|
false
|
2145
2270
|
end
|
2271
|
+
|
2272
|
+
|
2146
2273
|
end
|
2274
|
+
|
2147
2275
|
end
|
2148
2276
|
|
2149
2277
|
class Confirm < Protocol::Class
|
2150
2278
|
@name = "confirm"
|
2151
2279
|
@method_id = 85
|
2152
2280
|
|
2281
|
+
|
2282
|
+
|
2153
2283
|
class Select < Protocol::Method
|
2154
2284
|
@name = "confirm.select"
|
2155
2285
|
@method_id = 10
|
@@ -2175,15 +2305,16 @@ module AMQ
|
|
2175
2305
|
end
|
2176
2306
|
|
2177
2307
|
# @return
|
2178
|
-
# [
|
2308
|
+
# [u'nowait = false']
|
2179
2309
|
def self.encode(channel, nowait)
|
2180
|
-
buffer =
|
2310
|
+
buffer = ''
|
2181
2311
|
buffer << @packed_indexes
|
2182
2312
|
bit_buffer = 0
|
2183
2313
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
2184
2314
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2185
2315
|
MethodFrame.new(buffer, channel)
|
2186
2316
|
end
|
2317
|
+
|
2187
2318
|
end
|
2188
2319
|
|
2189
2320
|
class SelectOk < Protocol::Method
|
@@ -2208,13 +2339,16 @@ module AMQ
|
|
2208
2339
|
# @return
|
2209
2340
|
# []
|
2210
2341
|
def self.encode(channel)
|
2211
|
-
buffer =
|
2342
|
+
buffer = ''
|
2212
2343
|
buffer << @packed_indexes
|
2213
2344
|
MethodFrame.new(buffer, channel)
|
2214
2345
|
end
|
2346
|
+
|
2215
2347
|
end
|
2348
|
+
|
2216
2349
|
end
|
2217
2350
|
|
2351
|
+
|
2218
2352
|
METHODS = begin
|
2219
2353
|
Method.methods.inject(Hash.new) do |hash, klass|
|
2220
2354
|
hash.merge!(klass.index => klass)
|
@@ -2222,3 +2356,4 @@ module AMQ
|
|
2222
2356
|
end
|
2223
2357
|
end
|
2224
2358
|
end
|
2359
|
+
|