amq-protocol 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/codegen_helpers.py +6 -14
- data/lib/amq/protocol/client.rb +182 -317
- data/lib/amq/protocol/version.rb +1 -1
- data/spec/amq/protocol/exchange_spec.rb +18 -4
- metadata +4 -4
data/codegen_helpers.py
CHANGED
@@ -4,11 +4,11 @@ def genSingleEncode(spec, cValue, unresolved_domain):
|
|
4
4
|
buffer = []
|
5
5
|
type = spec.resolveDomain(unresolved_domain)
|
6
6
|
if type == 'shortstr':
|
7
|
-
buffer.append("buffer << %s.bytesize.chr" % (cValue,))
|
8
|
-
buffer.append("buffer << %s" % (cValue,))
|
7
|
+
buffer.append("buffer << %s.to_s.bytesize.chr" % (cValue,))
|
8
|
+
buffer.append("buffer << %s.to_s" % (cValue,))
|
9
9
|
elif type == 'longstr':
|
10
|
-
buffer.append("buffer << [%s.bytesize].pack(PACK_UINT32)" % (cValue,))
|
11
|
-
buffer.append("buffer << %s" % (cValue,))
|
10
|
+
buffer.append("buffer << [%s.to_s.bytesize].pack(PACK_UINT32)" % (cValue,))
|
11
|
+
buffer.append("buffer << %s.to_s" % (cValue,))
|
12
12
|
elif type == 'octet':
|
13
13
|
buffer.append("buffer << [%s].pack(PACK_CHAR)" % (cValue,))
|
14
14
|
elif type == 'short':
|
@@ -87,17 +87,9 @@ def genSingleSimpleDecode(spec, field):
|
|
87
87
|
type = spec.resolveDomain(unresolved_domain)
|
88
88
|
buffer = []
|
89
89
|
if type == 'shortstr':
|
90
|
-
|
91
|
-
# buffer.append("result = data[offset..-1]")
|
92
|
-
# buffer.append("raise 'Bad size: #{length} expected, got #{result.bytesize}' if result.bytesize != length")
|
93
|
-
# buffer.append("result")
|
94
|
-
buffer.append("data")
|
90
|
+
buffer.append("data.to_s")
|
95
91
|
elif type == 'longstr':
|
96
|
-
|
97
|
-
# buffer.append("result = data[offset..-1]")
|
98
|
-
# buffer.append("raise 'Bad size: #{length} expected, got #{result.bytesize}' if result.bytesize != length")
|
99
|
-
# buffer.append("result")
|
100
|
-
buffer.append("data")
|
92
|
+
buffer.append("data.to_s")
|
101
93
|
elif type == 'octet':
|
102
94
|
buffer.append("data.unpack(PACK_CHAR).first")
|
103
95
|
elif type == 'short':
|
data/lib/amq/protocol/client.rb
CHANGED
@@ -17,19 +17,17 @@ 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 =
|
31
|
-
|
32
|
-
|
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
|
33
31
|
|
34
32
|
# @return [Array] Collection of subclasses of AMQ::Protocol::Class.
|
35
33
|
def self.classes
|
@@ -170,9 +168,8 @@ module AMQ
|
|
170
168
|
VALUE = 541
|
171
169
|
end
|
172
170
|
|
173
|
-
|
174
|
-
#
|
175
|
-
# as we don't actually need any per-instance state.
|
171
|
+
# We don"t instantiate the following classes,
|
172
|
+
# as we don"t actually need any per-instance state.
|
176
173
|
# Also, this is pretty low-level functionality,
|
177
174
|
# hence it should have a reasonable performance.
|
178
175
|
# As everyone knows, garbage collector in MRI performs
|
@@ -180,10 +177,10 @@ module AMQ
|
|
180
177
|
# not creating any objects, but only use class as
|
181
178
|
# a struct. Creating classes is quite expensive though,
|
182
179
|
# but here the inheritance comes handy and mainly
|
183
|
-
# as we can
|
184
|
-
# we can
|
180
|
+
# as we can"t simply make a reference to a function,
|
181
|
+
# we can"t use a hash or an object. I"ve been also
|
185
182
|
# considering to have just a bunch of methods, but
|
186
|
-
# here
|
183
|
+
# here"s the problem, that after we"d require this file,
|
187
184
|
# all these methods would become global which would
|
188
185
|
# be a bad, bad thing to do.
|
189
186
|
class Class
|
@@ -280,8 +277,6 @@ module AMQ
|
|
280
277
|
@name = "connection"
|
281
278
|
@method_id = 10
|
282
279
|
|
283
|
-
|
284
|
-
|
285
280
|
class Start < Protocol::Method
|
286
281
|
@name = "connection.start"
|
287
282
|
@method_id = 10
|
@@ -321,8 +316,6 @@ module AMQ
|
|
321
316
|
def self.has_content?
|
322
317
|
false
|
323
318
|
end
|
324
|
-
|
325
|
-
|
326
319
|
end
|
327
320
|
|
328
321
|
class StartOk < Protocol::Method
|
@@ -331,27 +324,25 @@ module AMQ
|
|
331
324
|
@index = 0x000A000B # 10, 11, 655371
|
332
325
|
@packed_indexes = [10, 11].pack(PACK_UINT16_X2).freeze
|
333
326
|
|
334
|
-
|
335
327
|
def self.has_content?
|
336
328
|
false
|
337
329
|
end
|
338
330
|
|
339
331
|
# @return
|
340
|
-
# [
|
332
|
+
# ["client_properties = nil", "mechanism = "PLAIN"", "response = nil", "locale = "en_US""]
|
341
333
|
def self.encode(client_properties, mechanism, response, locale)
|
342
334
|
channel = 0
|
343
|
-
buffer =
|
335
|
+
buffer = ""
|
344
336
|
buffer << @packed_indexes
|
345
337
|
buffer << AMQ::Protocol::Table.encode(client_properties)
|
346
|
-
buffer << mechanism.bytesize.chr
|
347
|
-
buffer << mechanism
|
348
|
-
buffer << [response.bytesize].pack(PACK_UINT32)
|
349
|
-
buffer << response
|
350
|
-
buffer << locale.bytesize.chr
|
351
|
-
buffer << locale
|
338
|
+
buffer << mechanism.to_s.bytesize.chr
|
339
|
+
buffer << mechanism.to_s
|
340
|
+
buffer << [response.to_s.bytesize].pack(PACK_UINT32)
|
341
|
+
buffer << response.to_s
|
342
|
+
buffer << locale.to_s.bytesize.chr
|
343
|
+
buffer << locale.to_s
|
352
344
|
MethodFrame.new(buffer, channel)
|
353
345
|
end
|
354
|
-
|
355
346
|
end
|
356
347
|
|
357
348
|
class Secure < Protocol::Method
|
@@ -378,8 +369,6 @@ module AMQ
|
|
378
369
|
def self.has_content?
|
379
370
|
false
|
380
371
|
end
|
381
|
-
|
382
|
-
|
383
372
|
end
|
384
373
|
|
385
374
|
class SecureOk < Protocol::Method
|
@@ -388,22 +377,20 @@ module AMQ
|
|
388
377
|
@index = 0x000A0015 # 10, 21, 655381
|
389
378
|
@packed_indexes = [10, 21].pack(PACK_UINT16_X2).freeze
|
390
379
|
|
391
|
-
|
392
380
|
def self.has_content?
|
393
381
|
false
|
394
382
|
end
|
395
383
|
|
396
384
|
# @return
|
397
|
-
# [
|
385
|
+
# ["response = nil"]
|
398
386
|
def self.encode(response)
|
399
387
|
channel = 0
|
400
|
-
buffer =
|
388
|
+
buffer = ""
|
401
389
|
buffer << @packed_indexes
|
402
|
-
buffer << [response.bytesize].pack(PACK_UINT32)
|
403
|
-
buffer << response
|
390
|
+
buffer << [response.to_s.bytesize].pack(PACK_UINT32)
|
391
|
+
buffer << response.to_s
|
404
392
|
MethodFrame.new(buffer, channel)
|
405
393
|
end
|
406
|
-
|
407
394
|
end
|
408
395
|
|
409
396
|
class Tune < Protocol::Method
|
@@ -434,8 +421,6 @@ module AMQ
|
|
434
421
|
def self.has_content?
|
435
422
|
false
|
436
423
|
end
|
437
|
-
|
438
|
-
|
439
424
|
end
|
440
425
|
|
441
426
|
class TuneOk < Protocol::Method
|
@@ -444,23 +429,21 @@ module AMQ
|
|
444
429
|
@index = 0x000A001F # 10, 31, 655391
|
445
430
|
@packed_indexes = [10, 31].pack(PACK_UINT16_X2).freeze
|
446
431
|
|
447
|
-
|
448
432
|
def self.has_content?
|
449
433
|
false
|
450
434
|
end
|
451
435
|
|
452
436
|
# @return
|
453
|
-
# [
|
437
|
+
# ["channel_max = false", "frame_max = false", "heartbeat = false"]
|
454
438
|
def self.encode(channel_max, frame_max, heartbeat)
|
455
439
|
channel = 0
|
456
|
-
buffer =
|
440
|
+
buffer = ""
|
457
441
|
buffer << @packed_indexes
|
458
442
|
buffer << [channel_max].pack(PACK_UINT16)
|
459
443
|
buffer << [frame_max].pack(PACK_UINT32)
|
460
444
|
buffer << [heartbeat].pack(PACK_UINT16)
|
461
445
|
MethodFrame.new(buffer, channel)
|
462
446
|
end
|
463
|
-
|
464
447
|
end
|
465
448
|
|
466
449
|
class Open < Protocol::Method
|
@@ -469,29 +452,27 @@ module AMQ
|
|
469
452
|
@index = 0x000A0028 # 10, 40, 655400
|
470
453
|
@packed_indexes = [10, 40].pack(PACK_UINT16_X2).freeze
|
471
454
|
|
472
|
-
|
473
455
|
def self.has_content?
|
474
456
|
false
|
475
457
|
end
|
476
458
|
|
477
459
|
# @return
|
478
|
-
# [
|
460
|
+
# ["virtual_host = "/"", "capabilities = EMPTY_STRING", "insist = false"]
|
479
461
|
def self.encode(virtual_host)
|
480
462
|
capabilities = EMPTY_STRING
|
481
463
|
insist = false
|
482
464
|
channel = 0
|
483
|
-
buffer =
|
465
|
+
buffer = ""
|
484
466
|
buffer << @packed_indexes
|
485
|
-
buffer << virtual_host.bytesize.chr
|
486
|
-
buffer << virtual_host
|
487
|
-
buffer << capabilities.bytesize.chr
|
488
|
-
buffer << capabilities
|
467
|
+
buffer << virtual_host.to_s.bytesize.chr
|
468
|
+
buffer << virtual_host.to_s
|
469
|
+
buffer << capabilities.to_s.bytesize.chr
|
470
|
+
buffer << capabilities.to_s
|
489
471
|
bit_buffer = 0
|
490
472
|
bit_buffer = bit_buffer | (1 << 0) if insist
|
491
473
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
492
474
|
MethodFrame.new(buffer, channel)
|
493
475
|
end
|
494
|
-
|
495
476
|
end
|
496
477
|
|
497
478
|
class OpenOk < Protocol::Method
|
@@ -518,8 +499,6 @@ module AMQ
|
|
518
499
|
def self.has_content?
|
519
500
|
false
|
520
501
|
end
|
521
|
-
|
522
|
-
|
523
502
|
end
|
524
503
|
|
525
504
|
class Close < Protocol::Method
|
@@ -557,19 +536,18 @@ module AMQ
|
|
557
536
|
end
|
558
537
|
|
559
538
|
# @return
|
560
|
-
# [
|
539
|
+
# ["reply_code = nil", "reply_text = EMPTY_STRING", "class_id = nil", "method_id = nil"]
|
561
540
|
def self.encode(reply_code, reply_text, class_id, method_id)
|
562
541
|
channel = 0
|
563
|
-
buffer =
|
542
|
+
buffer = ""
|
564
543
|
buffer << @packed_indexes
|
565
544
|
buffer << [reply_code].pack(PACK_UINT16)
|
566
|
-
buffer << reply_text.bytesize.chr
|
567
|
-
buffer << reply_text
|
545
|
+
buffer << reply_text.to_s.bytesize.chr
|
546
|
+
buffer << reply_text.to_s
|
568
547
|
buffer << [class_id].pack(PACK_UINT16)
|
569
548
|
buffer << [method_id].pack(PACK_UINT16)
|
570
549
|
MethodFrame.new(buffer, channel)
|
571
550
|
end
|
572
|
-
|
573
551
|
end
|
574
552
|
|
575
553
|
class CloseOk < Protocol::Method
|
@@ -595,42 +573,36 @@ module AMQ
|
|
595
573
|
# []
|
596
574
|
def self.encode()
|
597
575
|
channel = 0
|
598
|
-
buffer =
|
576
|
+
buffer = ""
|
599
577
|
buffer << @packed_indexes
|
600
578
|
MethodFrame.new(buffer, channel)
|
601
579
|
end
|
602
|
-
|
603
580
|
end
|
604
|
-
|
605
581
|
end
|
606
582
|
|
607
583
|
class Channel < Protocol::Class
|
608
584
|
@name = "channel"
|
609
585
|
@method_id = 20
|
610
586
|
|
611
|
-
|
612
|
-
|
613
587
|
class Open < Protocol::Method
|
614
588
|
@name = "channel.open"
|
615
589
|
@method_id = 10
|
616
590
|
@index = 0x0014000A # 20, 10, 1310730
|
617
591
|
@packed_indexes = [20, 10].pack(PACK_UINT16_X2).freeze
|
618
592
|
|
619
|
-
|
620
593
|
def self.has_content?
|
621
594
|
false
|
622
595
|
end
|
623
596
|
|
624
597
|
# @return
|
625
|
-
# [
|
598
|
+
# ["out_of_band = EMPTY_STRING"]
|
626
599
|
def self.encode(channel, out_of_band)
|
627
|
-
buffer =
|
600
|
+
buffer = ""
|
628
601
|
buffer << @packed_indexes
|
629
|
-
buffer << out_of_band.bytesize.chr
|
630
|
-
buffer << out_of_band
|
602
|
+
buffer << out_of_band.to_s.bytesize.chr
|
603
|
+
buffer << out_of_band.to_s
|
631
604
|
MethodFrame.new(buffer, channel)
|
632
605
|
end
|
633
|
-
|
634
606
|
end
|
635
607
|
|
636
608
|
class OpenOk < Protocol::Method
|
@@ -657,8 +629,6 @@ module AMQ
|
|
657
629
|
def self.has_content?
|
658
630
|
false
|
659
631
|
end
|
660
|
-
|
661
|
-
|
662
632
|
end
|
663
633
|
|
664
634
|
class Flow < Protocol::Method
|
@@ -686,16 +656,15 @@ module AMQ
|
|
686
656
|
end
|
687
657
|
|
688
658
|
# @return
|
689
|
-
# [
|
659
|
+
# ["active = nil"]
|
690
660
|
def self.encode(channel, active)
|
691
|
-
buffer =
|
661
|
+
buffer = ""
|
692
662
|
buffer << @packed_indexes
|
693
663
|
bit_buffer = 0
|
694
664
|
bit_buffer = bit_buffer | (1 << 0) if active
|
695
665
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
696
666
|
MethodFrame.new(buffer, channel)
|
697
667
|
end
|
698
|
-
|
699
668
|
end
|
700
669
|
|
701
670
|
class FlowOk < Protocol::Method
|
@@ -723,16 +692,15 @@ module AMQ
|
|
723
692
|
end
|
724
693
|
|
725
694
|
# @return
|
726
|
-
# [
|
695
|
+
# ["active = nil"]
|
727
696
|
def self.encode(channel, active)
|
728
|
-
buffer =
|
697
|
+
buffer = ""
|
729
698
|
buffer << @packed_indexes
|
730
699
|
bit_buffer = 0
|
731
700
|
bit_buffer = bit_buffer | (1 << 0) if active
|
732
701
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
733
702
|
MethodFrame.new(buffer, channel)
|
734
703
|
end
|
735
|
-
|
736
704
|
end
|
737
705
|
|
738
706
|
class Close < Protocol::Method
|
@@ -770,18 +738,17 @@ module AMQ
|
|
770
738
|
end
|
771
739
|
|
772
740
|
# @return
|
773
|
-
# [
|
741
|
+
# ["reply_code = nil", "reply_text = EMPTY_STRING", "class_id = nil", "method_id = nil"]
|
774
742
|
def self.encode(channel, reply_code, reply_text, class_id, method_id)
|
775
|
-
buffer =
|
743
|
+
buffer = ""
|
776
744
|
buffer << @packed_indexes
|
777
745
|
buffer << [reply_code].pack(PACK_UINT16)
|
778
|
-
buffer << reply_text.bytesize.chr
|
779
|
-
buffer << reply_text
|
746
|
+
buffer << reply_text.to_s.bytesize.chr
|
747
|
+
buffer << reply_text.to_s
|
780
748
|
buffer << [class_id].pack(PACK_UINT16)
|
781
749
|
buffer << [method_id].pack(PACK_UINT16)
|
782
750
|
MethodFrame.new(buffer, channel)
|
783
751
|
end
|
784
|
-
|
785
752
|
end
|
786
753
|
|
787
754
|
class CloseOk < Protocol::Method
|
@@ -806,43 +773,38 @@ module AMQ
|
|
806
773
|
# @return
|
807
774
|
# []
|
808
775
|
def self.encode(channel)
|
809
|
-
buffer =
|
776
|
+
buffer = ""
|
810
777
|
buffer << @packed_indexes
|
811
778
|
MethodFrame.new(buffer, channel)
|
812
779
|
end
|
813
|
-
|
814
780
|
end
|
815
|
-
|
816
781
|
end
|
817
782
|
|
818
783
|
class Exchange < Protocol::Class
|
819
784
|
@name = "exchange"
|
820
785
|
@method_id = 40
|
821
786
|
|
822
|
-
|
823
|
-
|
824
787
|
class Declare < Protocol::Method
|
825
788
|
@name = "exchange.declare"
|
826
789
|
@method_id = 10
|
827
790
|
@index = 0x0028000A # 40, 10, 2621450
|
828
791
|
@packed_indexes = [40, 10].pack(PACK_UINT16_X2).freeze
|
829
792
|
|
830
|
-
|
831
793
|
def self.has_content?
|
832
794
|
false
|
833
795
|
end
|
834
796
|
|
835
797
|
# @return
|
836
|
-
# [
|
798
|
+
# ["ticket = 0", "exchange = nil", "type = "direct"", "passive = false", "durable = false", "auto_delete = false", "internal = false", "nowait = false", "arguments = {}"]
|
837
799
|
def self.encode(channel, exchange, type, passive, durable, auto_delete, internal, nowait, arguments)
|
838
800
|
ticket = 0
|
839
|
-
buffer =
|
801
|
+
buffer = ""
|
840
802
|
buffer << @packed_indexes
|
841
803
|
buffer << [ticket].pack(PACK_UINT16)
|
842
|
-
buffer << exchange.bytesize.chr
|
843
|
-
buffer << exchange
|
844
|
-
buffer << type.bytesize.chr
|
845
|
-
buffer << type
|
804
|
+
buffer << exchange.to_s.bytesize.chr
|
805
|
+
buffer << exchange.to_s
|
806
|
+
buffer << type.to_s.bytesize.chr
|
807
|
+
buffer << type.to_s
|
846
808
|
bit_buffer = 0
|
847
809
|
bit_buffer = bit_buffer | (1 << 0) if passive
|
848
810
|
bit_buffer = bit_buffer | (1 << 1) if durable
|
@@ -853,7 +815,6 @@ module AMQ
|
|
853
815
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
854
816
|
MethodFrame.new(buffer, channel)
|
855
817
|
end
|
856
|
-
|
857
818
|
end
|
858
819
|
|
859
820
|
class DeclareOk < Protocol::Method
|
@@ -874,8 +835,6 @@ module AMQ
|
|
874
835
|
def self.has_content?
|
875
836
|
false
|
876
837
|
end
|
877
|
-
|
878
|
-
|
879
838
|
end
|
880
839
|
|
881
840
|
class Delete < Protocol::Method
|
@@ -884,27 +843,25 @@ module AMQ
|
|
884
843
|
@index = 0x00280014 # 40, 20, 2621460
|
885
844
|
@packed_indexes = [40, 20].pack(PACK_UINT16_X2).freeze
|
886
845
|
|
887
|
-
|
888
846
|
def self.has_content?
|
889
847
|
false
|
890
848
|
end
|
891
849
|
|
892
850
|
# @return
|
893
|
-
# [
|
851
|
+
# ["ticket = 0", "exchange = nil", "if_unused = false", "nowait = false"]
|
894
852
|
def self.encode(channel, exchange, if_unused, nowait)
|
895
853
|
ticket = 0
|
896
|
-
buffer =
|
854
|
+
buffer = ""
|
897
855
|
buffer << @packed_indexes
|
898
856
|
buffer << [ticket].pack(PACK_UINT16)
|
899
|
-
buffer << exchange.bytesize.chr
|
900
|
-
buffer << exchange
|
857
|
+
buffer << exchange.to_s.bytesize.chr
|
858
|
+
buffer << exchange.to_s
|
901
859
|
bit_buffer = 0
|
902
860
|
bit_buffer = bit_buffer | (1 << 0) if if_unused
|
903
861
|
bit_buffer = bit_buffer | (1 << 1) if nowait
|
904
862
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
905
863
|
MethodFrame.new(buffer, channel)
|
906
864
|
end
|
907
|
-
|
908
865
|
end
|
909
866
|
|
910
867
|
class DeleteOk < Protocol::Method
|
@@ -925,8 +882,6 @@ module AMQ
|
|
925
882
|
def self.has_content?
|
926
883
|
false
|
927
884
|
end
|
928
|
-
|
929
|
-
|
930
885
|
end
|
931
886
|
|
932
887
|
class Bind < Protocol::Method
|
@@ -935,31 +890,29 @@ module AMQ
|
|
935
890
|
@index = 0x0028001E # 40, 30, 2621470
|
936
891
|
@packed_indexes = [40, 30].pack(PACK_UINT16_X2).freeze
|
937
892
|
|
938
|
-
|
939
893
|
def self.has_content?
|
940
894
|
false
|
941
895
|
end
|
942
896
|
|
943
897
|
# @return
|
944
|
-
# [
|
898
|
+
# ["ticket = 0", "destination = nil", "source = nil", "routing_key = EMPTY_STRING", "nowait = false", "arguments = {}"]
|
945
899
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
946
900
|
ticket = 0
|
947
|
-
buffer =
|
901
|
+
buffer = ""
|
948
902
|
buffer << @packed_indexes
|
949
903
|
buffer << [ticket].pack(PACK_UINT16)
|
950
|
-
buffer << destination.bytesize.chr
|
951
|
-
buffer << destination
|
952
|
-
buffer << source.bytesize.chr
|
953
|
-
buffer << source
|
954
|
-
buffer << routing_key.bytesize.chr
|
955
|
-
buffer << routing_key
|
904
|
+
buffer << destination.to_s.bytesize.chr
|
905
|
+
buffer << destination.to_s
|
906
|
+
buffer << source.to_s.bytesize.chr
|
907
|
+
buffer << source.to_s
|
908
|
+
buffer << routing_key.to_s.bytesize.chr
|
909
|
+
buffer << routing_key.to_s
|
956
910
|
bit_buffer = 0
|
957
911
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
958
912
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
959
913
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
960
914
|
MethodFrame.new(buffer, channel)
|
961
915
|
end
|
962
|
-
|
963
916
|
end
|
964
917
|
|
965
918
|
class BindOk < Protocol::Method
|
@@ -980,8 +933,6 @@ module AMQ
|
|
980
933
|
def self.has_content?
|
981
934
|
false
|
982
935
|
end
|
983
|
-
|
984
|
-
|
985
936
|
end
|
986
937
|
|
987
938
|
class Unbind < Protocol::Method
|
@@ -990,31 +941,29 @@ module AMQ
|
|
990
941
|
@index = 0x00280028 # 40, 40, 2621480
|
991
942
|
@packed_indexes = [40, 40].pack(PACK_UINT16_X2).freeze
|
992
943
|
|
993
|
-
|
994
944
|
def self.has_content?
|
995
945
|
false
|
996
946
|
end
|
997
947
|
|
998
948
|
# @return
|
999
|
-
# [
|
949
|
+
# ["ticket = 0", "destination = nil", "source = nil", "routing_key = EMPTY_STRING", "nowait = false", "arguments = {}"]
|
1000
950
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
1001
951
|
ticket = 0
|
1002
|
-
buffer =
|
952
|
+
buffer = ""
|
1003
953
|
buffer << @packed_indexes
|
1004
954
|
buffer << [ticket].pack(PACK_UINT16)
|
1005
|
-
buffer << destination.bytesize.chr
|
1006
|
-
buffer << destination
|
1007
|
-
buffer << source.bytesize.chr
|
1008
|
-
buffer << source
|
1009
|
-
buffer << routing_key.bytesize.chr
|
1010
|
-
buffer << routing_key
|
955
|
+
buffer << destination.to_s.bytesize.chr
|
956
|
+
buffer << destination.to_s
|
957
|
+
buffer << source.to_s.bytesize.chr
|
958
|
+
buffer << source.to_s
|
959
|
+
buffer << routing_key.to_s.bytesize.chr
|
960
|
+
buffer << routing_key.to_s
|
1011
961
|
bit_buffer = 0
|
1012
962
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
1013
963
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1014
964
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1015
965
|
MethodFrame.new(buffer, channel)
|
1016
966
|
end
|
1017
|
-
|
1018
967
|
end
|
1019
968
|
|
1020
969
|
class UnbindOk < Protocol::Method
|
@@ -1035,38 +984,32 @@ module AMQ
|
|
1035
984
|
def self.has_content?
|
1036
985
|
false
|
1037
986
|
end
|
1038
|
-
|
1039
|
-
|
1040
987
|
end
|
1041
|
-
|
1042
988
|
end
|
1043
989
|
|
1044
990
|
class Queue < Protocol::Class
|
1045
991
|
@name = "queue"
|
1046
992
|
@method_id = 50
|
1047
993
|
|
1048
|
-
|
1049
|
-
|
1050
994
|
class Declare < Protocol::Method
|
1051
995
|
@name = "queue.declare"
|
1052
996
|
@method_id = 10
|
1053
997
|
@index = 0x0032000A # 50, 10, 3276810
|
1054
998
|
@packed_indexes = [50, 10].pack(PACK_UINT16_X2).freeze
|
1055
999
|
|
1056
|
-
|
1057
1000
|
def self.has_content?
|
1058
1001
|
false
|
1059
1002
|
end
|
1060
1003
|
|
1061
1004
|
# @return
|
1062
|
-
# [
|
1005
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "passive = false", "durable = false", "exclusive = false", "auto_delete = false", "nowait = false", "arguments = {}"]
|
1063
1006
|
def self.encode(channel, queue, passive, durable, exclusive, auto_delete, nowait, arguments)
|
1064
1007
|
ticket = 0
|
1065
|
-
buffer =
|
1008
|
+
buffer = ""
|
1066
1009
|
buffer << @packed_indexes
|
1067
1010
|
buffer << [ticket].pack(PACK_UINT16)
|
1068
|
-
buffer << queue.bytesize.chr
|
1069
|
-
buffer << queue
|
1011
|
+
buffer << queue.to_s.bytesize.chr
|
1012
|
+
buffer << queue.to_s
|
1070
1013
|
bit_buffer = 0
|
1071
1014
|
bit_buffer = bit_buffer | (1 << 0) if passive
|
1072
1015
|
bit_buffer = bit_buffer | (1 << 1) if durable
|
@@ -1077,7 +1020,6 @@ module AMQ
|
|
1077
1020
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1078
1021
|
MethodFrame.new(buffer, channel)
|
1079
1022
|
end
|
1080
|
-
|
1081
1023
|
end
|
1082
1024
|
|
1083
1025
|
class DeclareOk < Protocol::Method
|
@@ -1110,8 +1052,6 @@ module AMQ
|
|
1110
1052
|
def self.has_content?
|
1111
1053
|
false
|
1112
1054
|
end
|
1113
|
-
|
1114
|
-
|
1115
1055
|
end
|
1116
1056
|
|
1117
1057
|
class Bind < Protocol::Method
|
@@ -1120,31 +1060,29 @@ module AMQ
|
|
1120
1060
|
@index = 0x00320014 # 50, 20, 3276820
|
1121
1061
|
@packed_indexes = [50, 20].pack(PACK_UINT16_X2).freeze
|
1122
1062
|
|
1123
|
-
|
1124
1063
|
def self.has_content?
|
1125
1064
|
false
|
1126
1065
|
end
|
1127
1066
|
|
1128
1067
|
# @return
|
1129
|
-
# [
|
1068
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "exchange = nil", "routing_key = EMPTY_STRING", "nowait = false", "arguments = {}"]
|
1130
1069
|
def self.encode(channel, queue, exchange, routing_key, nowait, arguments)
|
1131
1070
|
ticket = 0
|
1132
|
-
buffer =
|
1071
|
+
buffer = ""
|
1133
1072
|
buffer << @packed_indexes
|
1134
1073
|
buffer << [ticket].pack(PACK_UINT16)
|
1135
|
-
buffer << queue.bytesize.chr
|
1136
|
-
buffer << queue
|
1137
|
-
buffer << exchange.bytesize.chr
|
1138
|
-
buffer << exchange
|
1139
|
-
buffer << routing_key.bytesize.chr
|
1140
|
-
buffer << routing_key
|
1074
|
+
buffer << queue.to_s.bytesize.chr
|
1075
|
+
buffer << queue.to_s
|
1076
|
+
buffer << exchange.to_s.bytesize.chr
|
1077
|
+
buffer << exchange.to_s
|
1078
|
+
buffer << routing_key.to_s.bytesize.chr
|
1079
|
+
buffer << routing_key.to_s
|
1141
1080
|
bit_buffer = 0
|
1142
1081
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
1143
1082
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1144
1083
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1145
1084
|
MethodFrame.new(buffer, channel)
|
1146
1085
|
end
|
1147
|
-
|
1148
1086
|
end
|
1149
1087
|
|
1150
1088
|
class BindOk < Protocol::Method
|
@@ -1165,8 +1103,6 @@ module AMQ
|
|
1165
1103
|
def self.has_content?
|
1166
1104
|
false
|
1167
1105
|
end
|
1168
|
-
|
1169
|
-
|
1170
1106
|
end
|
1171
1107
|
|
1172
1108
|
class Purge < Protocol::Method
|
@@ -1175,26 +1111,24 @@ module AMQ
|
|
1175
1111
|
@index = 0x0032001E # 50, 30, 3276830
|
1176
1112
|
@packed_indexes = [50, 30].pack(PACK_UINT16_X2).freeze
|
1177
1113
|
|
1178
|
-
|
1179
1114
|
def self.has_content?
|
1180
1115
|
false
|
1181
1116
|
end
|
1182
1117
|
|
1183
1118
|
# @return
|
1184
|
-
# [
|
1119
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "nowait = false"]
|
1185
1120
|
def self.encode(channel, queue, nowait)
|
1186
1121
|
ticket = 0
|
1187
|
-
buffer =
|
1122
|
+
buffer = ""
|
1188
1123
|
buffer << @packed_indexes
|
1189
1124
|
buffer << [ticket].pack(PACK_UINT16)
|
1190
|
-
buffer << queue.bytesize.chr
|
1191
|
-
buffer << queue
|
1125
|
+
buffer << queue.to_s.bytesize.chr
|
1126
|
+
buffer << queue.to_s
|
1192
1127
|
bit_buffer = 0
|
1193
1128
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
1194
1129
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1195
1130
|
MethodFrame.new(buffer, channel)
|
1196
1131
|
end
|
1197
|
-
|
1198
1132
|
end
|
1199
1133
|
|
1200
1134
|
class PurgeOk < Protocol::Method
|
@@ -1219,8 +1153,6 @@ module AMQ
|
|
1219
1153
|
def self.has_content?
|
1220
1154
|
false
|
1221
1155
|
end
|
1222
|
-
|
1223
|
-
|
1224
1156
|
end
|
1225
1157
|
|
1226
1158
|
class Delete < Protocol::Method
|
@@ -1229,20 +1161,19 @@ module AMQ
|
|
1229
1161
|
@index = 0x00320028 # 50, 40, 3276840
|
1230
1162
|
@packed_indexes = [50, 40].pack(PACK_UINT16_X2).freeze
|
1231
1163
|
|
1232
|
-
|
1233
1164
|
def self.has_content?
|
1234
1165
|
false
|
1235
1166
|
end
|
1236
1167
|
|
1237
1168
|
# @return
|
1238
|
-
# [
|
1169
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "if_unused = false", "if_empty = false", "nowait = false"]
|
1239
1170
|
def self.encode(channel, queue, if_unused, if_empty, nowait)
|
1240
1171
|
ticket = 0
|
1241
|
-
buffer =
|
1172
|
+
buffer = ""
|
1242
1173
|
buffer << @packed_indexes
|
1243
1174
|
buffer << [ticket].pack(PACK_UINT16)
|
1244
|
-
buffer << queue.bytesize.chr
|
1245
|
-
buffer << queue
|
1175
|
+
buffer << queue.to_s.bytesize.chr
|
1176
|
+
buffer << queue.to_s
|
1246
1177
|
bit_buffer = 0
|
1247
1178
|
bit_buffer = bit_buffer | (1 << 0) if if_unused
|
1248
1179
|
bit_buffer = bit_buffer | (1 << 1) if if_empty
|
@@ -1250,7 +1181,6 @@ module AMQ
|
|
1250
1181
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1251
1182
|
MethodFrame.new(buffer, channel)
|
1252
1183
|
end
|
1253
|
-
|
1254
1184
|
end
|
1255
1185
|
|
1256
1186
|
class DeleteOk < Protocol::Method
|
@@ -1275,8 +1205,6 @@ module AMQ
|
|
1275
1205
|
def self.has_content?
|
1276
1206
|
false
|
1277
1207
|
end
|
1278
|
-
|
1279
|
-
|
1280
1208
|
end
|
1281
1209
|
|
1282
1210
|
class Unbind < Protocol::Method
|
@@ -1285,28 +1213,26 @@ module AMQ
|
|
1285
1213
|
@index = 0x00320032 # 50, 50, 3276850
|
1286
1214
|
@packed_indexes = [50, 50].pack(PACK_UINT16_X2).freeze
|
1287
1215
|
|
1288
|
-
|
1289
1216
|
def self.has_content?
|
1290
1217
|
false
|
1291
1218
|
end
|
1292
1219
|
|
1293
1220
|
# @return
|
1294
|
-
# [
|
1221
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "exchange = nil", "routing_key = EMPTY_STRING", "arguments = {}"]
|
1295
1222
|
def self.encode(channel, queue, exchange, routing_key, arguments)
|
1296
1223
|
ticket = 0
|
1297
|
-
buffer =
|
1224
|
+
buffer = ""
|
1298
1225
|
buffer << @packed_indexes
|
1299
1226
|
buffer << [ticket].pack(PACK_UINT16)
|
1300
|
-
buffer << queue.bytesize.chr
|
1301
|
-
buffer << queue
|
1302
|
-
buffer << exchange.bytesize.chr
|
1303
|
-
buffer << exchange
|
1304
|
-
buffer << routing_key.bytesize.chr
|
1305
|
-
buffer << routing_key
|
1227
|
+
buffer << queue.to_s.bytesize.chr
|
1228
|
+
buffer << queue.to_s
|
1229
|
+
buffer << exchange.to_s.bytesize.chr
|
1230
|
+
buffer << exchange.to_s
|
1231
|
+
buffer << routing_key.to_s.bytesize.chr
|
1232
|
+
buffer << routing_key.to_s
|
1306
1233
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1307
1234
|
MethodFrame.new(buffer, channel)
|
1308
1235
|
end
|
1309
|
-
|
1310
1236
|
end
|
1311
1237
|
|
1312
1238
|
class UnbindOk < Protocol::Method
|
@@ -1327,10 +1253,7 @@ module AMQ
|
|
1327
1253
|
def self.has_content?
|
1328
1254
|
false
|
1329
1255
|
end
|
1330
|
-
|
1331
|
-
|
1332
1256
|
end
|
1333
|
-
|
1334
1257
|
end
|
1335
1258
|
|
1336
1259
|
class Basic < Protocol::Class
|
@@ -1356,114 +1279,112 @@ module AMQ
|
|
1356
1279
|
|
1357
1280
|
# 1 << 15
|
1358
1281
|
def self.encode_content_type(value)
|
1359
|
-
buffer =
|
1360
|
-
buffer << value.bytesize.chr
|
1361
|
-
buffer << value
|
1282
|
+
buffer = ""
|
1283
|
+
buffer << value.to_s.bytesize.chr
|
1284
|
+
buffer << value.to_s
|
1362
1285
|
[0, 0x8000, buffer]
|
1363
1286
|
end
|
1364
1287
|
|
1365
1288
|
# 1 << 14
|
1366
1289
|
def self.encode_content_encoding(value)
|
1367
|
-
buffer =
|
1368
|
-
buffer << value.bytesize.chr
|
1369
|
-
buffer << value
|
1290
|
+
buffer = ""
|
1291
|
+
buffer << value.to_s.bytesize.chr
|
1292
|
+
buffer << value.to_s
|
1370
1293
|
[1, 0x4000, buffer]
|
1371
1294
|
end
|
1372
1295
|
|
1373
1296
|
# 1 << 13
|
1374
1297
|
def self.encode_headers(value)
|
1375
|
-
buffer =
|
1298
|
+
buffer = ""
|
1376
1299
|
buffer << AMQ::Protocol::Table.encode(value)
|
1377
1300
|
[2, 0x2000, buffer]
|
1378
1301
|
end
|
1379
1302
|
|
1380
1303
|
# 1 << 12
|
1381
1304
|
def self.encode_delivery_mode(value)
|
1382
|
-
buffer =
|
1305
|
+
buffer = ""
|
1383
1306
|
buffer << [value].pack(PACK_CHAR)
|
1384
1307
|
[3, 0x1000, buffer]
|
1385
1308
|
end
|
1386
1309
|
|
1387
1310
|
# 1 << 11
|
1388
1311
|
def self.encode_priority(value)
|
1389
|
-
buffer =
|
1312
|
+
buffer = ""
|
1390
1313
|
buffer << [value].pack(PACK_CHAR)
|
1391
1314
|
[4, 0x0800, buffer]
|
1392
1315
|
end
|
1393
1316
|
|
1394
1317
|
# 1 << 10
|
1395
1318
|
def self.encode_correlation_id(value)
|
1396
|
-
buffer =
|
1397
|
-
buffer << value.bytesize.chr
|
1398
|
-
buffer << value
|
1319
|
+
buffer = ""
|
1320
|
+
buffer << value.to_s.bytesize.chr
|
1321
|
+
buffer << value.to_s
|
1399
1322
|
[5, 0x0400, buffer]
|
1400
1323
|
end
|
1401
1324
|
|
1402
1325
|
# 1 << 9
|
1403
1326
|
def self.encode_reply_to(value)
|
1404
|
-
buffer =
|
1405
|
-
buffer << value.bytesize.chr
|
1406
|
-
buffer << value
|
1327
|
+
buffer = ""
|
1328
|
+
buffer << value.to_s.bytesize.chr
|
1329
|
+
buffer << value.to_s
|
1407
1330
|
[6, 0x0200, buffer]
|
1408
1331
|
end
|
1409
1332
|
|
1410
1333
|
# 1 << 8
|
1411
1334
|
def self.encode_expiration(value)
|
1412
|
-
buffer =
|
1413
|
-
buffer << value.bytesize.chr
|
1414
|
-
buffer << value
|
1335
|
+
buffer = ""
|
1336
|
+
buffer << value.to_s.bytesize.chr
|
1337
|
+
buffer << value.to_s
|
1415
1338
|
[7, 0x0100, buffer]
|
1416
1339
|
end
|
1417
1340
|
|
1418
1341
|
# 1 << 7
|
1419
1342
|
def self.encode_message_id(value)
|
1420
|
-
buffer =
|
1421
|
-
buffer << value.bytesize.chr
|
1422
|
-
buffer << value
|
1343
|
+
buffer = ""
|
1344
|
+
buffer << value.to_s.bytesize.chr
|
1345
|
+
buffer << value.to_s
|
1423
1346
|
[8, 0x0080, buffer]
|
1424
1347
|
end
|
1425
1348
|
|
1426
1349
|
# 1 << 6
|
1427
1350
|
def self.encode_timestamp(value)
|
1428
|
-
buffer =
|
1351
|
+
buffer = ""
|
1429
1352
|
buffer << AMQ::Hacks.pack_64_big_endian(value)
|
1430
1353
|
[9, 0x0040, buffer]
|
1431
1354
|
end
|
1432
1355
|
|
1433
1356
|
# 1 << 5
|
1434
1357
|
def self.encode_type(value)
|
1435
|
-
buffer =
|
1436
|
-
buffer << value.bytesize.chr
|
1437
|
-
buffer << value
|
1358
|
+
buffer = ""
|
1359
|
+
buffer << value.to_s.bytesize.chr
|
1360
|
+
buffer << value.to_s
|
1438
1361
|
[10, 0x0020, buffer]
|
1439
1362
|
end
|
1440
1363
|
|
1441
1364
|
# 1 << 4
|
1442
1365
|
def self.encode_user_id(value)
|
1443
|
-
buffer =
|
1444
|
-
buffer << value.bytesize.chr
|
1445
|
-
buffer << value
|
1366
|
+
buffer = ""
|
1367
|
+
buffer << value.to_s.bytesize.chr
|
1368
|
+
buffer << value.to_s
|
1446
1369
|
[11, 0x0010, buffer]
|
1447
1370
|
end
|
1448
1371
|
|
1449
1372
|
# 1 << 3
|
1450
1373
|
def self.encode_app_id(value)
|
1451
|
-
buffer =
|
1452
|
-
buffer << value.bytesize.chr
|
1453
|
-
buffer << value
|
1374
|
+
buffer = ""
|
1375
|
+
buffer << value.to_s.bytesize.chr
|
1376
|
+
buffer << value.to_s
|
1454
1377
|
[12, 0x0008, buffer]
|
1455
1378
|
end
|
1456
1379
|
|
1457
1380
|
# 1 << 2
|
1458
1381
|
def self.encode_cluster_id(value)
|
1459
|
-
buffer =
|
1460
|
-
buffer << value.bytesize.chr
|
1461
|
-
buffer << value
|
1382
|
+
buffer = ""
|
1383
|
+
buffer << value.to_s.bytesize.chr
|
1384
|
+
buffer << value.to_s
|
1462
1385
|
[13, 0x0004, buffer]
|
1463
1386
|
end
|
1464
1387
|
|
1465
|
-
|
1466
|
-
|
1467
1388
|
def self.encode_properties(body_size, properties)
|
1468
1389
|
pieces, flags = [], 0
|
1469
1390
|
|
@@ -1473,7 +1394,7 @@ module AMQ
|
|
1473
1394
|
pieces[i] = result
|
1474
1395
|
end
|
1475
1396
|
|
1476
|
-
# result = [60, 0, body_size, flags].pack(
|
1397
|
+
# result = [60, 0, body_size, flags].pack("n2Qn")
|
1477
1398
|
result = [60, 0].pack(PACK_UINT16_X2)
|
1478
1399
|
result += AMQ::Hacks.pack_64_big_endian(body_size)
|
1479
1400
|
result += [flags].pack(PACK_UINT16)
|
@@ -1515,7 +1436,7 @@ module AMQ
|
|
1515
1436
|
0x0004 => :shortstr,
|
1516
1437
|
}
|
1517
1438
|
|
1518
|
-
# Hash doesn
|
1439
|
+
# Hash doesn"t give any guarantees on keys order, we will do it in a
|
1519
1440
|
# straightforward way
|
1520
1441
|
DECODE_PROPERTIES_KEYS = [
|
1521
1442
|
0x8000,
|
@@ -1573,15 +1494,14 @@ module AMQ
|
|
1573
1494
|
@index = 0x003C000A # 60, 10, 3932170
|
1574
1495
|
@packed_indexes = [60, 10].pack(PACK_UINT16_X2).freeze
|
1575
1496
|
|
1576
|
-
|
1577
1497
|
def self.has_content?
|
1578
1498
|
false
|
1579
1499
|
end
|
1580
1500
|
|
1581
1501
|
# @return
|
1582
|
-
# [
|
1502
|
+
# ["prefetch_size = false", "prefetch_count = false", "global = false"]
|
1583
1503
|
def self.encode(channel, prefetch_size, prefetch_count, global)
|
1584
|
-
buffer =
|
1504
|
+
buffer = ""
|
1585
1505
|
buffer << @packed_indexes
|
1586
1506
|
buffer << [prefetch_size].pack(PACK_UINT32)
|
1587
1507
|
buffer << [prefetch_count].pack(PACK_UINT16)
|
@@ -1590,7 +1510,6 @@ module AMQ
|
|
1590
1510
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1591
1511
|
MethodFrame.new(buffer, channel)
|
1592
1512
|
end
|
1593
|
-
|
1594
1513
|
end
|
1595
1514
|
|
1596
1515
|
class QosOk < Protocol::Method
|
@@ -1611,8 +1530,6 @@ module AMQ
|
|
1611
1530
|
def self.has_content?
|
1612
1531
|
false
|
1613
1532
|
end
|
1614
|
-
|
1615
|
-
|
1616
1533
|
end
|
1617
1534
|
|
1618
1535
|
class Consume < Protocol::Method
|
@@ -1621,22 +1538,21 @@ module AMQ
|
|
1621
1538
|
@index = 0x003C0014 # 60, 20, 3932180
|
1622
1539
|
@packed_indexes = [60, 20].pack(PACK_UINT16_X2).freeze
|
1623
1540
|
|
1624
|
-
|
1625
1541
|
def self.has_content?
|
1626
1542
|
false
|
1627
1543
|
end
|
1628
1544
|
|
1629
1545
|
# @return
|
1630
|
-
# [
|
1546
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "consumer_tag = EMPTY_STRING", "no_local = false", "no_ack = false", "exclusive = false", "nowait = false", "arguments = {}"]
|
1631
1547
|
def self.encode(channel, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments)
|
1632
1548
|
ticket = 0
|
1633
|
-
buffer =
|
1549
|
+
buffer = ""
|
1634
1550
|
buffer << @packed_indexes
|
1635
1551
|
buffer << [ticket].pack(PACK_UINT16)
|
1636
|
-
buffer << queue.bytesize.chr
|
1637
|
-
buffer << queue
|
1638
|
-
buffer << consumer_tag.bytesize.chr
|
1639
|
-
buffer << consumer_tag
|
1552
|
+
buffer << queue.to_s.bytesize.chr
|
1553
|
+
buffer << queue.to_s
|
1554
|
+
buffer << consumer_tag.to_s.bytesize.chr
|
1555
|
+
buffer << consumer_tag.to_s
|
1640
1556
|
bit_buffer = 0
|
1641
1557
|
bit_buffer = bit_buffer | (1 << 0) if no_local
|
1642
1558
|
bit_buffer = bit_buffer | (1 << 1) if no_ack
|
@@ -1646,7 +1562,6 @@ module AMQ
|
|
1646
1562
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1647
1563
|
MethodFrame.new(buffer, channel)
|
1648
1564
|
end
|
1649
|
-
|
1650
1565
|
end
|
1651
1566
|
|
1652
1567
|
class ConsumeOk < Protocol::Method
|
@@ -1673,8 +1588,6 @@ module AMQ
|
|
1673
1588
|
def self.has_content?
|
1674
1589
|
false
|
1675
1590
|
end
|
1676
|
-
|
1677
|
-
|
1678
1591
|
end
|
1679
1592
|
|
1680
1593
|
class Cancel < Protocol::Method
|
@@ -1707,18 +1620,17 @@ module AMQ
|
|
1707
1620
|
end
|
1708
1621
|
|
1709
1622
|
# @return
|
1710
|
-
# [
|
1623
|
+
# ["consumer_tag = nil", "nowait = false"]
|
1711
1624
|
def self.encode(channel, consumer_tag, nowait)
|
1712
|
-
buffer =
|
1625
|
+
buffer = ""
|
1713
1626
|
buffer << @packed_indexes
|
1714
|
-
buffer << consumer_tag.bytesize.chr
|
1715
|
-
buffer << consumer_tag
|
1627
|
+
buffer << consumer_tag.to_s.bytesize.chr
|
1628
|
+
buffer << consumer_tag.to_s
|
1716
1629
|
bit_buffer = 0
|
1717
1630
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
1718
1631
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1719
1632
|
MethodFrame.new(buffer, channel)
|
1720
1633
|
end
|
1721
|
-
|
1722
1634
|
end
|
1723
1635
|
|
1724
1636
|
class CancelOk < Protocol::Method
|
@@ -1745,8 +1657,6 @@ module AMQ
|
|
1745
1657
|
def self.has_content?
|
1746
1658
|
false
|
1747
1659
|
end
|
1748
|
-
|
1749
|
-
|
1750
1660
|
end
|
1751
1661
|
|
1752
1662
|
class Publish < Protocol::Method
|
@@ -1755,22 +1665,21 @@ module AMQ
|
|
1755
1665
|
@index = 0x003C0028 # 60, 40, 3932200
|
1756
1666
|
@packed_indexes = [60, 40].pack(PACK_UINT16_X2).freeze
|
1757
1667
|
|
1758
|
-
|
1759
1668
|
def self.has_content?
|
1760
1669
|
true
|
1761
1670
|
end
|
1762
1671
|
|
1763
1672
|
# @return
|
1764
|
-
# [
|
1673
|
+
# ["ticket = 0", "exchange = EMPTY_STRING", "routing_key = EMPTY_STRING", "mandatory = false", "immediate = false", "user_headers = nil", "payload = """, "frame_size = nil"]
|
1765
1674
|
def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size)
|
1766
1675
|
ticket = 0
|
1767
|
-
buffer =
|
1676
|
+
buffer = ""
|
1768
1677
|
buffer << @packed_indexes
|
1769
1678
|
buffer << [ticket].pack(PACK_UINT16)
|
1770
|
-
buffer << exchange.bytesize.chr
|
1771
|
-
buffer << exchange
|
1772
|
-
buffer << routing_key.bytesize.chr
|
1773
|
-
buffer << routing_key
|
1679
|
+
buffer << exchange.to_s.bytesize.chr
|
1680
|
+
buffer << exchange.to_s
|
1681
|
+
buffer << routing_key.to_s.bytesize.chr
|
1682
|
+
buffer << routing_key.to_s
|
1774
1683
|
bit_buffer = 0
|
1775
1684
|
bit_buffer = bit_buffer | (1 << 0) if mandatory
|
1776
1685
|
bit_buffer = bit_buffer | (1 << 1) if immediate
|
@@ -1785,7 +1694,6 @@ module AMQ
|
|
1785
1694
|
frames << HeaderFrame.new(properties_payload, channel)
|
1786
1695
|
frames + self.encode_body(payload, channel, frame_size)
|
1787
1696
|
end
|
1788
|
-
|
1789
1697
|
end
|
1790
1698
|
|
1791
1699
|
class Return < Protocol::Method
|
@@ -1825,8 +1733,6 @@ module AMQ
|
|
1825
1733
|
def self.has_content?
|
1826
1734
|
true
|
1827
1735
|
end
|
1828
|
-
|
1829
|
-
|
1830
1736
|
end
|
1831
1737
|
|
1832
1738
|
class Deliver < Protocol::Method
|
@@ -1870,8 +1776,6 @@ module AMQ
|
|
1870
1776
|
def self.has_content?
|
1871
1777
|
true
|
1872
1778
|
end
|
1873
|
-
|
1874
|
-
|
1875
1779
|
end
|
1876
1780
|
|
1877
1781
|
class Get < Protocol::Method
|
@@ -1880,26 +1784,24 @@ module AMQ
|
|
1880
1784
|
@index = 0x003C0046 # 60, 70, 3932230
|
1881
1785
|
@packed_indexes = [60, 70].pack(PACK_UINT16_X2).freeze
|
1882
1786
|
|
1883
|
-
|
1884
1787
|
def self.has_content?
|
1885
1788
|
false
|
1886
1789
|
end
|
1887
1790
|
|
1888
1791
|
# @return
|
1889
|
-
# [
|
1792
|
+
# ["ticket = 0", "queue = EMPTY_STRING", "no_ack = false"]
|
1890
1793
|
def self.encode(channel, queue, no_ack)
|
1891
1794
|
ticket = 0
|
1892
|
-
buffer =
|
1795
|
+
buffer = ""
|
1893
1796
|
buffer << @packed_indexes
|
1894
1797
|
buffer << [ticket].pack(PACK_UINT16)
|
1895
|
-
buffer << queue.bytesize.chr
|
1896
|
-
buffer << queue
|
1798
|
+
buffer << queue.to_s.bytesize.chr
|
1799
|
+
buffer << queue.to_s
|
1897
1800
|
bit_buffer = 0
|
1898
1801
|
bit_buffer = bit_buffer | (1 << 0) if no_ack
|
1899
1802
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1900
1803
|
MethodFrame.new(buffer, channel)
|
1901
1804
|
end
|
1902
|
-
|
1903
1805
|
end
|
1904
1806
|
|
1905
1807
|
class GetOk < Protocol::Method
|
@@ -1941,8 +1843,6 @@ module AMQ
|
|
1941
1843
|
def self.has_content?
|
1942
1844
|
true
|
1943
1845
|
end
|
1944
|
-
|
1945
|
-
|
1946
1846
|
end
|
1947
1847
|
|
1948
1848
|
class GetEmpty < Protocol::Method
|
@@ -1969,8 +1869,6 @@ module AMQ
|
|
1969
1869
|
def self.has_content?
|
1970
1870
|
false
|
1971
1871
|
end
|
1972
|
-
|
1973
|
-
|
1974
1872
|
end
|
1975
1873
|
|
1976
1874
|
class Ack < Protocol::Method
|
@@ -2001,9 +1899,9 @@ module AMQ
|
|
2001
1899
|
end
|
2002
1900
|
|
2003
1901
|
# @return
|
2004
|
-
# [
|
1902
|
+
# ["delivery_tag = false", "multiple = false"]
|
2005
1903
|
def self.encode(channel, delivery_tag, multiple)
|
2006
|
-
buffer =
|
1904
|
+
buffer = ""
|
2007
1905
|
buffer << @packed_indexes
|
2008
1906
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
2009
1907
|
bit_buffer = 0
|
@@ -2011,7 +1909,6 @@ module AMQ
|
|
2011
1909
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2012
1910
|
MethodFrame.new(buffer, channel)
|
2013
1911
|
end
|
2014
|
-
|
2015
1912
|
end
|
2016
1913
|
|
2017
1914
|
class Reject < Protocol::Method
|
@@ -2020,15 +1917,14 @@ module AMQ
|
|
2020
1917
|
@index = 0x003C005A # 60, 90, 3932250
|
2021
1918
|
@packed_indexes = [60, 90].pack(PACK_UINT16_X2).freeze
|
2022
1919
|
|
2023
|
-
|
2024
1920
|
def self.has_content?
|
2025
1921
|
false
|
2026
1922
|
end
|
2027
1923
|
|
2028
1924
|
# @return
|
2029
|
-
# [
|
1925
|
+
# ["delivery_tag = nil", "requeue = true"]
|
2030
1926
|
def self.encode(channel, delivery_tag, requeue)
|
2031
|
-
buffer =
|
1927
|
+
buffer = ""
|
2032
1928
|
buffer << @packed_indexes
|
2033
1929
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
2034
1930
|
bit_buffer = 0
|
@@ -2036,7 +1932,6 @@ module AMQ
|
|
2036
1932
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2037
1933
|
MethodFrame.new(buffer, channel)
|
2038
1934
|
end
|
2039
|
-
|
2040
1935
|
end
|
2041
1936
|
|
2042
1937
|
class RecoverAsync < Protocol::Method
|
@@ -2045,22 +1940,20 @@ module AMQ
|
|
2045
1940
|
@index = 0x003C0064 # 60, 100, 3932260
|
2046
1941
|
@packed_indexes = [60, 100].pack(PACK_UINT16_X2).freeze
|
2047
1942
|
|
2048
|
-
|
2049
1943
|
def self.has_content?
|
2050
1944
|
false
|
2051
1945
|
end
|
2052
1946
|
|
2053
1947
|
# @return
|
2054
|
-
# [
|
1948
|
+
# ["requeue = false"]
|
2055
1949
|
def self.encode(channel, requeue)
|
2056
|
-
buffer =
|
1950
|
+
buffer = ""
|
2057
1951
|
buffer << @packed_indexes
|
2058
1952
|
bit_buffer = 0
|
2059
1953
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
2060
1954
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2061
1955
|
MethodFrame.new(buffer, channel)
|
2062
1956
|
end
|
2063
|
-
|
2064
1957
|
end
|
2065
1958
|
|
2066
1959
|
class Recover < Protocol::Method
|
@@ -2069,22 +1962,20 @@ module AMQ
|
|
2069
1962
|
@index = 0x003C006E # 60, 110, 3932270
|
2070
1963
|
@packed_indexes = [60, 110].pack(PACK_UINT16_X2).freeze
|
2071
1964
|
|
2072
|
-
|
2073
1965
|
def self.has_content?
|
2074
1966
|
false
|
2075
1967
|
end
|
2076
1968
|
|
2077
1969
|
# @return
|
2078
|
-
# [
|
1970
|
+
# ["requeue = false"]
|
2079
1971
|
def self.encode(channel, requeue)
|
2080
|
-
buffer =
|
1972
|
+
buffer = ""
|
2081
1973
|
buffer << @packed_indexes
|
2082
1974
|
bit_buffer = 0
|
2083
1975
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
2084
1976
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2085
1977
|
MethodFrame.new(buffer, channel)
|
2086
1978
|
end
|
2087
|
-
|
2088
1979
|
end
|
2089
1980
|
|
2090
1981
|
class RecoverOk < Protocol::Method
|
@@ -2105,8 +1996,6 @@ module AMQ
|
|
2105
1996
|
def self.has_content?
|
2106
1997
|
false
|
2107
1998
|
end
|
2108
|
-
|
2109
|
-
|
2110
1999
|
end
|
2111
2000
|
|
2112
2001
|
class Nack < Protocol::Method
|
@@ -2139,9 +2028,9 @@ module AMQ
|
|
2139
2028
|
end
|
2140
2029
|
|
2141
2030
|
# @return
|
2142
|
-
# [
|
2031
|
+
# ["delivery_tag = false", "multiple = false", "requeue = true"]
|
2143
2032
|
def self.encode(channel, delivery_tag, multiple, requeue)
|
2144
|
-
buffer =
|
2033
|
+
buffer = ""
|
2145
2034
|
buffer << @packed_indexes
|
2146
2035
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
2147
2036
|
bit_buffer = 0
|
@@ -2150,24 +2039,19 @@ module AMQ
|
|
2150
2039
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2151
2040
|
MethodFrame.new(buffer, channel)
|
2152
2041
|
end
|
2153
|
-
|
2154
2042
|
end
|
2155
|
-
|
2156
2043
|
end
|
2157
2044
|
|
2158
2045
|
class Tx < Protocol::Class
|
2159
2046
|
@name = "tx"
|
2160
2047
|
@method_id = 90
|
2161
2048
|
|
2162
|
-
|
2163
|
-
|
2164
2049
|
class Select < Protocol::Method
|
2165
2050
|
@name = "tx.select"
|
2166
2051
|
@method_id = 10
|
2167
2052
|
@index = 0x005A000A # 90, 10, 5898250
|
2168
2053
|
@packed_indexes = [90, 10].pack(PACK_UINT16_X2).freeze
|
2169
2054
|
|
2170
|
-
|
2171
2055
|
def self.has_content?
|
2172
2056
|
false
|
2173
2057
|
end
|
@@ -2175,11 +2059,10 @@ module AMQ
|
|
2175
2059
|
# @return
|
2176
2060
|
# []
|
2177
2061
|
def self.encode(channel)
|
2178
|
-
buffer =
|
2062
|
+
buffer = ""
|
2179
2063
|
buffer << @packed_indexes
|
2180
2064
|
MethodFrame.new(buffer, channel)
|
2181
2065
|
end
|
2182
|
-
|
2183
2066
|
end
|
2184
2067
|
|
2185
2068
|
class SelectOk < Protocol::Method
|
@@ -2200,8 +2083,6 @@ module AMQ
|
|
2200
2083
|
def self.has_content?
|
2201
2084
|
false
|
2202
2085
|
end
|
2203
|
-
|
2204
|
-
|
2205
2086
|
end
|
2206
2087
|
|
2207
2088
|
class Commit < Protocol::Method
|
@@ -2210,7 +2091,6 @@ module AMQ
|
|
2210
2091
|
@index = 0x005A0014 # 90, 20, 5898260
|
2211
2092
|
@packed_indexes = [90, 20].pack(PACK_UINT16_X2).freeze
|
2212
2093
|
|
2213
|
-
|
2214
2094
|
def self.has_content?
|
2215
2095
|
false
|
2216
2096
|
end
|
@@ -2218,11 +2098,10 @@ module AMQ
|
|
2218
2098
|
# @return
|
2219
2099
|
# []
|
2220
2100
|
def self.encode(channel)
|
2221
|
-
buffer =
|
2101
|
+
buffer = ""
|
2222
2102
|
buffer << @packed_indexes
|
2223
2103
|
MethodFrame.new(buffer, channel)
|
2224
2104
|
end
|
2225
|
-
|
2226
2105
|
end
|
2227
2106
|
|
2228
2107
|
class CommitOk < Protocol::Method
|
@@ -2243,8 +2122,6 @@ module AMQ
|
|
2243
2122
|
def self.has_content?
|
2244
2123
|
false
|
2245
2124
|
end
|
2246
|
-
|
2247
|
-
|
2248
2125
|
end
|
2249
2126
|
|
2250
2127
|
class Rollback < Protocol::Method
|
@@ -2253,7 +2130,6 @@ module AMQ
|
|
2253
2130
|
@index = 0x005A001E # 90, 30, 5898270
|
2254
2131
|
@packed_indexes = [90, 30].pack(PACK_UINT16_X2).freeze
|
2255
2132
|
|
2256
|
-
|
2257
2133
|
def self.has_content?
|
2258
2134
|
false
|
2259
2135
|
end
|
@@ -2261,11 +2137,10 @@ module AMQ
|
|
2261
2137
|
# @return
|
2262
2138
|
# []
|
2263
2139
|
def self.encode(channel)
|
2264
|
-
buffer =
|
2140
|
+
buffer = ""
|
2265
2141
|
buffer << @packed_indexes
|
2266
2142
|
MethodFrame.new(buffer, channel)
|
2267
2143
|
end
|
2268
|
-
|
2269
2144
|
end
|
2270
2145
|
|
2271
2146
|
class RollbackOk < Protocol::Method
|
@@ -2286,18 +2161,13 @@ module AMQ
|
|
2286
2161
|
def self.has_content?
|
2287
2162
|
false
|
2288
2163
|
end
|
2289
|
-
|
2290
|
-
|
2291
2164
|
end
|
2292
|
-
|
2293
2165
|
end
|
2294
2166
|
|
2295
2167
|
class Confirm < Protocol::Class
|
2296
2168
|
@name = "confirm"
|
2297
2169
|
@method_id = 85
|
2298
2170
|
|
2299
|
-
|
2300
|
-
|
2301
2171
|
class Select < Protocol::Method
|
2302
2172
|
@name = "confirm.select"
|
2303
2173
|
@method_id = 10
|
@@ -2323,16 +2193,15 @@ module AMQ
|
|
2323
2193
|
end
|
2324
2194
|
|
2325
2195
|
# @return
|
2326
|
-
# [
|
2196
|
+
# ["nowait = false"]
|
2327
2197
|
def self.encode(channel, nowait)
|
2328
|
-
buffer =
|
2198
|
+
buffer = ""
|
2329
2199
|
buffer << @packed_indexes
|
2330
2200
|
bit_buffer = 0
|
2331
2201
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
2332
2202
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2333
2203
|
MethodFrame.new(buffer, channel)
|
2334
2204
|
end
|
2335
|
-
|
2336
2205
|
end
|
2337
2206
|
|
2338
2207
|
class SelectOk < Protocol::Method
|
@@ -2357,16 +2226,13 @@ module AMQ
|
|
2357
2226
|
# @return
|
2358
2227
|
# []
|
2359
2228
|
def self.encode(channel)
|
2360
|
-
buffer =
|
2229
|
+
buffer = ""
|
2361
2230
|
buffer << @packed_indexes
|
2362
2231
|
MethodFrame.new(buffer, channel)
|
2363
2232
|
end
|
2364
|
-
|
2365
2233
|
end
|
2366
|
-
|
2367
2234
|
end
|
2368
2235
|
|
2369
|
-
|
2370
2236
|
METHODS = begin
|
2371
2237
|
Method.methods.inject(Hash.new) do |hash, klass|
|
2372
2238
|
hash.merge!(klass.index => klass)
|
@@ -2374,4 +2240,3 @@ module AMQ
|
|
2374
2240
|
end
|
2375
2241
|
end
|
2376
2242
|
end
|
2377
|
-
|