amq-protocol 1.0.0.pre7 → 1.0.0
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/.gitmodules +2 -2
- data/ChangeLog.md +23 -0
- data/LICENSE +1 -0
- data/README.md +21 -10
- data/{__init__.py → codegen/__init__.py} +0 -0
- data/{amqp_0.9.1_changes.json → codegen/amqp_0.9.1_changes.json} +0 -0
- data/{codegen.py → codegen/codegen.py} +3 -3
- data/{codegen_helpers.py → codegen/codegen_helpers.py} +0 -0
- data/{protocol.rb.pytemplate → codegen/protocol.rb.pytemplate} +4 -2
- data/generate.rb +3 -3
- data/lib/amq/protocol/client.rb +234 -97
- data/lib/amq/protocol/frame.rb +2 -1
- data/lib/amq/protocol/version.rb +1 -1
- data/lib/amq/settings.rb +132 -0
- data/spec/amq/protocol/constants_spec.rb +14 -0
- data/spec/amq/settings_spec.rb +116 -0
- metadata +66 -80
- data/irb.rb +0 -98
- data/post-processing.rb +0 -25
data/.gitmodules
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
[submodule "
|
2
|
-
path =
|
1
|
+
[submodule "codegen/rabbitmq-codegen"]
|
2
|
+
path = codegen/rabbitmq-codegen
|
3
3
|
url = git://github.com/rabbitmq/rabbitmq-codegen.git
|
data/ChangeLog.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
## Changes between 1.0.0.pre6 and 1.0.0.pre7
|
2
|
+
|
3
|
+
### AMQ::Settings
|
4
|
+
|
5
|
+
`AMQ::Settings` extracts settings merging logic and AMQP/AMQPS URI parsing from `amq-client`.
|
6
|
+
Parsing follows the same convention amqp gem and RabbitMQ Java client follow.
|
7
|
+
|
8
|
+
Examples:
|
9
|
+
|
10
|
+
``` ruby
|
11
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com") # => vhost is nil, so default (/) will be used
|
12
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/") # => vhost is an empty string
|
13
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/%2Fvault") # => vhost is /vault
|
14
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/production") # => vhost is production
|
15
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/a.b.c") # => vhost is a.b.c
|
16
|
+
AMQ::Settings.parse_amqp_url("amqp://dev.rabbitmq.com/foo/bar") # => ArgumentError
|
17
|
+
```
|
18
|
+
|
19
|
+
|
20
|
+
### AMQ::Protocol::TLS_PORT
|
21
|
+
|
22
|
+
`AMQ::Protocol::TLS_PORT` is a new constant that contains default AMQPS 0.9.1 port,
|
23
|
+
5671.
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
amq-protocol is an AMQP 0.9.1 serialization library for Ruby. It is not an
|
4
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
5
|
|
7
|
-
|
8
|
-
|
9
|
-
See [this page about AMQP gems family](https://github.com/ruby-amqp/amq-client/blob/master/README.textile)
|
6
|
+
If you want to write your own AMQP client, this gem will handle all the serialization
|
7
|
+
needs for you, including RabbitMQ extensions to AMQP 0.9.1.
|
10
8
|
|
11
9
|
|
12
10
|
## Installation
|
@@ -23,11 +21,11 @@ Make sure you have Python, pip and the mako templating package installed:
|
|
23
21
|
amq-protocol uses RabbitMQ protocol code generation library that is in Python, so there is some
|
24
22
|
Python involved in the build.
|
25
23
|
|
26
|
-
To regenerate `lib/amq/protocol/client.rb` from the source (`
|
24
|
+
To regenerate `lib/amq/protocol/client.rb` from the source (`codegen/*` files), run
|
27
25
|
|
28
26
|
./generate.rb
|
29
27
|
|
30
|
-
To make changes, **do not edit client.rb directly**. Instead, edit `protocol.rb.pytemplate` and regenerate.
|
28
|
+
To make changes, **do not edit client.rb directly**. Instead, edit the `codegen/protocol.rb.pytemplate` and regenerate.
|
31
29
|
|
32
30
|
To run tests, use
|
33
31
|
|
@@ -40,8 +38,21 @@ To run tests, use
|
|
40
38
|
amq-protocol is maintained by [Michael Klishin](https://github.com/michaelklishin).
|
41
39
|
|
42
40
|
|
43
|
-
##
|
41
|
+
## CI Status
|
42
|
+
|
43
|
+
[](https://travis-ci.org/ruby-amqp/amq-protocol)
|
44
|
+
|
45
|
+
|
46
|
+
## Development
|
47
|
+
|
48
|
+
Please report any issues you may find to our [Issue tracker](http://github.com/ruby-amqp/amq-protocol/issues) on GitHub.
|
49
|
+
|
50
|
+
|
51
|
+
## Mailing List
|
52
|
+
|
53
|
+
Any questions you may have should be sent to the [Ruby AMQP mailing list](http://groups.google.com/group/ruby-amqp).
|
54
|
+
|
55
|
+
|
56
|
+
## License
|
44
57
|
|
45
|
-
|
46
|
-
* [Ruby AMQP mailing list](http://groups.google.com/group/ruby-amqp)
|
47
|
-
* [Issue tracker](http://github.com/ruby-amqp/amq-protocol/issues)
|
58
|
+
MIT (see LICENSE in the repository root).
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
import os, sys, re
|
8
8
|
|
9
|
-
sys.path.append(os.path.join("
|
9
|
+
sys.path.append(os.path.join("codegen", "rabbitmq-codegen"))
|
10
10
|
|
11
11
|
from amqp_codegen import *
|
12
12
|
try:
|
@@ -61,7 +61,7 @@ AmqpEntity.__init__ = new_init
|
|
61
61
|
|
62
62
|
# method.accepted_by("server")
|
63
63
|
# method.accepted_by("client", "server")
|
64
|
-
accepted_by_update = json.loads(file("amqp_0.9.1_changes.json").read())
|
64
|
+
accepted_by_update = json.loads(file("codegen/amqp_0.9.1_changes.json").read())
|
65
65
|
|
66
66
|
def accepted_by(self, *receivers):
|
67
67
|
def get_accepted_by(self):
|
@@ -147,7 +147,7 @@ def generateMain(type):
|
|
147
147
|
def main(json_spec_path):
|
148
148
|
spec = AmqpSpecObject(json_spec_path)
|
149
149
|
spec.type = type
|
150
|
-
print render("protocol.rb.pytemplate", spec = spec)
|
150
|
+
print render("codegen/protocol.rb.pytemplate", spec = spec)
|
151
151
|
|
152
152
|
return main
|
153
153
|
|
File without changes
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# encoding: binary
|
3
3
|
|
4
4
|
# THIS IS AN AUTOGENERATED FILE, DO NOT MODIFY
|
5
|
-
# IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE
|
6
|
-
# IN THE
|
5
|
+
# IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE FILES
|
6
|
+
# IN THE ./codegen DIRECTORY OF THE AMQ-PROTOCOL REPOSITORY.<% import codegen_helpers as helpers %><% import re, os, codegen %>
|
7
7
|
|
8
8
|
require "amq/protocol/table"
|
9
9
|
require "amq/protocol/frame"
|
@@ -14,6 +14,8 @@ module AMQ
|
|
14
14
|
PROTOCOL_VERSION = "${spec.major}.${spec.minor}.${spec.revision}".freeze
|
15
15
|
PREAMBLE = "${'AMQP\\x00\\x%02x\\x%02x\\x%02x' % (spec.major, spec.minor, spec.revision)}".freeze
|
16
16
|
DEFAULT_PORT = ${spec.port}
|
17
|
+
TLS_PORT = 5671
|
18
|
+
SSL_PORT = 5671
|
17
19
|
|
18
20
|
# caching
|
19
21
|
EMPTY_STRING = "".freeze
|
data/generate.rb
CHANGED
@@ -5,14 +5,14 @@ def sh(*args)
|
|
5
5
|
system(*args)
|
6
6
|
end
|
7
7
|
|
8
|
-
spec = "
|
8
|
+
spec = "codegen/rabbitmq-codegen/amqp-rabbitmq-0.9.1.json"
|
9
9
|
unless File.exist?(spec)
|
10
10
|
sh "git submodule update --init"
|
11
11
|
end
|
12
12
|
|
13
13
|
path = "lib/amq/protocol/client.rb"
|
14
|
-
|
14
|
+
puts "Running ./codegen/codegen.py client #{spec} #{path}"
|
15
|
+
sh "./codegen/codegen.py client #{spec} #{path}"
|
15
16
|
if File.file?(path)
|
16
|
-
sh "./post-processing.rb #{path}"
|
17
17
|
sh "ruby -c #{path}"
|
18
18
|
end
|
data/lib/amq/protocol/client.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
|
3
3
|
# THIS IS AN AUTOGENERATED FILE, DO NOT MODIFY
|
4
|
-
# IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE
|
5
|
-
# IN THE
|
4
|
+
# IT DIRECTLY ! FOR CHANGES, PLEASE UPDATE FILES
|
5
|
+
# IN THE ./codegen DIRECTORY OF THE AMQ-PROTOCOL REPOSITORY.
|
6
6
|
|
7
7
|
require "amq/protocol/table"
|
8
8
|
require "amq/protocol/frame"
|
@@ -13,21 +13,25 @@ module AMQ
|
|
13
13
|
PROTOCOL_VERSION = "0.9.1".freeze
|
14
14
|
PREAMBLE = "AMQP\x00\x00\x09\x01".freeze
|
15
15
|
DEFAULT_PORT = 5672
|
16
|
+
TLS_PORT = 5671
|
17
|
+
SSL_PORT = 5671
|
16
18
|
|
17
19
|
# caching
|
18
20
|
EMPTY_STRING = "".freeze
|
19
21
|
|
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 =
|
22
|
+
PACK_CHAR = 'C'.freeze
|
23
|
+
PACK_UINT16 = 'n'.freeze
|
24
|
+
PACK_UINT16_X2 = 'n2'.freeze
|
25
|
+
PACK_UINT32 = 'N'.freeze
|
26
|
+
PACK_UINT32_X2 = 'N2'.freeze
|
27
|
+
PACK_INT64 = 'q'.freeze
|
28
|
+
PACK_UCHAR_UINT32 = 'CN'.freeze
|
29
|
+
PACK_CHAR_UINT16_UINT32 = 'cnN'.freeze
|
30
|
+
|
31
|
+
PACK_32BIT_FLOAT = 'f'.freeze
|
32
|
+
PACK_64BIT_FLOAT = 'd'.freeze
|
33
|
+
|
28
34
|
|
29
|
-
PACK_32BIT_FLOAT = "f".freeze
|
30
|
-
PACK_64BIT_FLOAT = "d".freeze
|
31
35
|
|
32
36
|
# @return [Array] Collection of subclasses of AMQ::Protocol::Class.
|
33
37
|
def self.classes
|
@@ -168,8 +172,9 @@ module AMQ
|
|
168
172
|
VALUE = 541
|
169
173
|
end
|
170
174
|
|
171
|
-
|
172
|
-
#
|
175
|
+
|
176
|
+
# We don't instantiate the following classes,
|
177
|
+
# as we don't actually need any per-instance state.
|
173
178
|
# Also, this is pretty low-level functionality,
|
174
179
|
# hence it should have a reasonable performance.
|
175
180
|
# As everyone knows, garbage collector in MRI performs
|
@@ -177,10 +182,10 @@ module AMQ
|
|
177
182
|
# not creating any objects, but only use class as
|
178
183
|
# a struct. Creating classes is quite expensive though,
|
179
184
|
# but here the inheritance comes handy and mainly
|
180
|
-
# as we can
|
181
|
-
# we can
|
185
|
+
# as we can't simply make a reference to a function,
|
186
|
+
# we can't use a hash or an object. I've been also
|
182
187
|
# considering to have just a bunch of methods, but
|
183
|
-
# here
|
188
|
+
# here's the problem, that after we'd require this file,
|
184
189
|
# all these methods would become global which would
|
185
190
|
# be a bad, bad thing to do.
|
186
191
|
class Class
|
@@ -277,6 +282,8 @@ module AMQ
|
|
277
282
|
@name = "connection"
|
278
283
|
@method_id = 10
|
279
284
|
|
285
|
+
|
286
|
+
|
280
287
|
class Start < Protocol::Method
|
281
288
|
@name = "connection.start"
|
282
289
|
@method_id = 10
|
@@ -316,6 +323,8 @@ module AMQ
|
|
316
323
|
def self.has_content?
|
317
324
|
false
|
318
325
|
end
|
326
|
+
|
327
|
+
|
319
328
|
end
|
320
329
|
|
321
330
|
class StartOk < Protocol::Method
|
@@ -324,15 +333,16 @@ module AMQ
|
|
324
333
|
@index = 0x000A000B # 10, 11, 655371
|
325
334
|
@packed_indexes = [10, 11].pack(PACK_UINT16_X2).freeze
|
326
335
|
|
336
|
+
|
327
337
|
def self.has_content?
|
328
338
|
false
|
329
339
|
end
|
330
340
|
|
331
341
|
# @return
|
332
|
-
# [
|
342
|
+
# [u'client_properties = nil', u"mechanism = u'PLAIN'", u'response = nil', u"locale = u'en_US'"]
|
333
343
|
def self.encode(client_properties, mechanism, response, locale)
|
334
344
|
channel = 0
|
335
|
-
buffer =
|
345
|
+
buffer = ''
|
336
346
|
buffer << @packed_indexes
|
337
347
|
buffer << AMQ::Protocol::Table.encode(client_properties)
|
338
348
|
buffer << mechanism.to_s.bytesize.chr
|
@@ -343,6 +353,7 @@ module AMQ
|
|
343
353
|
buffer << locale.to_s
|
344
354
|
MethodFrame.new(buffer, channel)
|
345
355
|
end
|
356
|
+
|
346
357
|
end
|
347
358
|
|
348
359
|
class Secure < Protocol::Method
|
@@ -369,6 +380,8 @@ module AMQ
|
|
369
380
|
def self.has_content?
|
370
381
|
false
|
371
382
|
end
|
383
|
+
|
384
|
+
|
372
385
|
end
|
373
386
|
|
374
387
|
class SecureOk < Protocol::Method
|
@@ -377,20 +390,22 @@ module AMQ
|
|
377
390
|
@index = 0x000A0015 # 10, 21, 655381
|
378
391
|
@packed_indexes = [10, 21].pack(PACK_UINT16_X2).freeze
|
379
392
|
|
393
|
+
|
380
394
|
def self.has_content?
|
381
395
|
false
|
382
396
|
end
|
383
397
|
|
384
398
|
# @return
|
385
|
-
# [
|
399
|
+
# [u'response = nil']
|
386
400
|
def self.encode(response)
|
387
401
|
channel = 0
|
388
|
-
buffer =
|
402
|
+
buffer = ''
|
389
403
|
buffer << @packed_indexes
|
390
404
|
buffer << [response.to_s.bytesize].pack(PACK_UINT32)
|
391
405
|
buffer << response.to_s
|
392
406
|
MethodFrame.new(buffer, channel)
|
393
407
|
end
|
408
|
+
|
394
409
|
end
|
395
410
|
|
396
411
|
class Tune < Protocol::Method
|
@@ -421,6 +436,8 @@ module AMQ
|
|
421
436
|
def self.has_content?
|
422
437
|
false
|
423
438
|
end
|
439
|
+
|
440
|
+
|
424
441
|
end
|
425
442
|
|
426
443
|
class TuneOk < Protocol::Method
|
@@ -429,21 +446,23 @@ module AMQ
|
|
429
446
|
@index = 0x000A001F # 10, 31, 655391
|
430
447
|
@packed_indexes = [10, 31].pack(PACK_UINT16_X2).freeze
|
431
448
|
|
449
|
+
|
432
450
|
def self.has_content?
|
433
451
|
false
|
434
452
|
end
|
435
453
|
|
436
454
|
# @return
|
437
|
-
# [
|
455
|
+
# [u'channel_max = false', u'frame_max = false', u'heartbeat = false']
|
438
456
|
def self.encode(channel_max, frame_max, heartbeat)
|
439
457
|
channel = 0
|
440
|
-
buffer =
|
458
|
+
buffer = ''
|
441
459
|
buffer << @packed_indexes
|
442
460
|
buffer << [channel_max].pack(PACK_UINT16)
|
443
461
|
buffer << [frame_max].pack(PACK_UINT32)
|
444
462
|
buffer << [heartbeat].pack(PACK_UINT16)
|
445
463
|
MethodFrame.new(buffer, channel)
|
446
464
|
end
|
465
|
+
|
447
466
|
end
|
448
467
|
|
449
468
|
class Open < Protocol::Method
|
@@ -452,17 +471,18 @@ module AMQ
|
|
452
471
|
@index = 0x000A0028 # 10, 40, 655400
|
453
472
|
@packed_indexes = [10, 40].pack(PACK_UINT16_X2).freeze
|
454
473
|
|
474
|
+
|
455
475
|
def self.has_content?
|
456
476
|
false
|
457
477
|
end
|
458
478
|
|
459
479
|
# @return
|
460
|
-
# ["virtual_host =
|
480
|
+
# [u"virtual_host = u'/'", u'capabilities = EMPTY_STRING', u'insist = false']
|
461
481
|
def self.encode(virtual_host)
|
462
482
|
capabilities = EMPTY_STRING
|
463
483
|
insist = false
|
464
484
|
channel = 0
|
465
|
-
buffer =
|
485
|
+
buffer = ''
|
466
486
|
buffer << @packed_indexes
|
467
487
|
buffer << virtual_host.to_s.bytesize.chr
|
468
488
|
buffer << virtual_host.to_s
|
@@ -473,6 +493,7 @@ module AMQ
|
|
473
493
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
474
494
|
MethodFrame.new(buffer, channel)
|
475
495
|
end
|
496
|
+
|
476
497
|
end
|
477
498
|
|
478
499
|
class OpenOk < Protocol::Method
|
@@ -499,6 +520,8 @@ module AMQ
|
|
499
520
|
def self.has_content?
|
500
521
|
false
|
501
522
|
end
|
523
|
+
|
524
|
+
|
502
525
|
end
|
503
526
|
|
504
527
|
class Close < Protocol::Method
|
@@ -536,10 +559,10 @@ module AMQ
|
|
536
559
|
end
|
537
560
|
|
538
561
|
# @return
|
539
|
-
# [
|
562
|
+
# [u'reply_code = nil', u'reply_text = EMPTY_STRING', u'class_id = nil', u'method_id = nil']
|
540
563
|
def self.encode(reply_code, reply_text, class_id, method_id)
|
541
564
|
channel = 0
|
542
|
-
buffer =
|
565
|
+
buffer = ''
|
543
566
|
buffer << @packed_indexes
|
544
567
|
buffer << [reply_code].pack(PACK_UINT16)
|
545
568
|
buffer << reply_text.to_s.bytesize.chr
|
@@ -548,6 +571,7 @@ module AMQ
|
|
548
571
|
buffer << [method_id].pack(PACK_UINT16)
|
549
572
|
MethodFrame.new(buffer, channel)
|
550
573
|
end
|
574
|
+
|
551
575
|
end
|
552
576
|
|
553
577
|
class CloseOk < Protocol::Method
|
@@ -573,36 +597,42 @@ module AMQ
|
|
573
597
|
# []
|
574
598
|
def self.encode()
|
575
599
|
channel = 0
|
576
|
-
buffer =
|
600
|
+
buffer = ''
|
577
601
|
buffer << @packed_indexes
|
578
602
|
MethodFrame.new(buffer, channel)
|
579
603
|
end
|
604
|
+
|
580
605
|
end
|
606
|
+
|
581
607
|
end
|
582
608
|
|
583
609
|
class Channel < Protocol::Class
|
584
610
|
@name = "channel"
|
585
611
|
@method_id = 20
|
586
612
|
|
613
|
+
|
614
|
+
|
587
615
|
class Open < Protocol::Method
|
588
616
|
@name = "channel.open"
|
589
617
|
@method_id = 10
|
590
618
|
@index = 0x0014000A # 20, 10, 1310730
|
591
619
|
@packed_indexes = [20, 10].pack(PACK_UINT16_X2).freeze
|
592
620
|
|
621
|
+
|
593
622
|
def self.has_content?
|
594
623
|
false
|
595
624
|
end
|
596
625
|
|
597
626
|
# @return
|
598
|
-
# [
|
627
|
+
# [u'out_of_band = EMPTY_STRING']
|
599
628
|
def self.encode(channel, out_of_band)
|
600
|
-
buffer =
|
629
|
+
buffer = ''
|
601
630
|
buffer << @packed_indexes
|
602
631
|
buffer << out_of_band.to_s.bytesize.chr
|
603
632
|
buffer << out_of_band.to_s
|
604
633
|
MethodFrame.new(buffer, channel)
|
605
634
|
end
|
635
|
+
|
606
636
|
end
|
607
637
|
|
608
638
|
class OpenOk < Protocol::Method
|
@@ -629,6 +659,8 @@ module AMQ
|
|
629
659
|
def self.has_content?
|
630
660
|
false
|
631
661
|
end
|
662
|
+
|
663
|
+
|
632
664
|
end
|
633
665
|
|
634
666
|
class Flow < Protocol::Method
|
@@ -656,15 +688,16 @@ module AMQ
|
|
656
688
|
end
|
657
689
|
|
658
690
|
# @return
|
659
|
-
# [
|
691
|
+
# [u'active = nil']
|
660
692
|
def self.encode(channel, active)
|
661
|
-
buffer =
|
693
|
+
buffer = ''
|
662
694
|
buffer << @packed_indexes
|
663
695
|
bit_buffer = 0
|
664
696
|
bit_buffer = bit_buffer | (1 << 0) if active
|
665
697
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
666
698
|
MethodFrame.new(buffer, channel)
|
667
699
|
end
|
700
|
+
|
668
701
|
end
|
669
702
|
|
670
703
|
class FlowOk < Protocol::Method
|
@@ -692,15 +725,16 @@ module AMQ
|
|
692
725
|
end
|
693
726
|
|
694
727
|
# @return
|
695
|
-
# [
|
728
|
+
# [u'active = nil']
|
696
729
|
def self.encode(channel, active)
|
697
|
-
buffer =
|
730
|
+
buffer = ''
|
698
731
|
buffer << @packed_indexes
|
699
732
|
bit_buffer = 0
|
700
733
|
bit_buffer = bit_buffer | (1 << 0) if active
|
701
734
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
702
735
|
MethodFrame.new(buffer, channel)
|
703
736
|
end
|
737
|
+
|
704
738
|
end
|
705
739
|
|
706
740
|
class Close < Protocol::Method
|
@@ -738,9 +772,9 @@ module AMQ
|
|
738
772
|
end
|
739
773
|
|
740
774
|
# @return
|
741
|
-
# [
|
775
|
+
# [u'reply_code = nil', u'reply_text = EMPTY_STRING', u'class_id = nil', u'method_id = nil']
|
742
776
|
def self.encode(channel, reply_code, reply_text, class_id, method_id)
|
743
|
-
buffer =
|
777
|
+
buffer = ''
|
744
778
|
buffer << @packed_indexes
|
745
779
|
buffer << [reply_code].pack(PACK_UINT16)
|
746
780
|
buffer << reply_text.to_s.bytesize.chr
|
@@ -749,6 +783,7 @@ module AMQ
|
|
749
783
|
buffer << [method_id].pack(PACK_UINT16)
|
750
784
|
MethodFrame.new(buffer, channel)
|
751
785
|
end
|
786
|
+
|
752
787
|
end
|
753
788
|
|
754
789
|
class CloseOk < Protocol::Method
|
@@ -773,32 +808,37 @@ module AMQ
|
|
773
808
|
# @return
|
774
809
|
# []
|
775
810
|
def self.encode(channel)
|
776
|
-
buffer =
|
811
|
+
buffer = ''
|
777
812
|
buffer << @packed_indexes
|
778
813
|
MethodFrame.new(buffer, channel)
|
779
814
|
end
|
815
|
+
|
780
816
|
end
|
817
|
+
|
781
818
|
end
|
782
819
|
|
783
820
|
class Exchange < Protocol::Class
|
784
821
|
@name = "exchange"
|
785
822
|
@method_id = 40
|
786
823
|
|
824
|
+
|
825
|
+
|
787
826
|
class Declare < Protocol::Method
|
788
827
|
@name = "exchange.declare"
|
789
828
|
@method_id = 10
|
790
829
|
@index = 0x0028000A # 40, 10, 2621450
|
791
830
|
@packed_indexes = [40, 10].pack(PACK_UINT16_X2).freeze
|
792
831
|
|
832
|
+
|
793
833
|
def self.has_content?
|
794
834
|
false
|
795
835
|
end
|
796
836
|
|
797
837
|
# @return
|
798
|
-
# [
|
838
|
+
# [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 = {}']
|
799
839
|
def self.encode(channel, exchange, type, passive, durable, auto_delete, internal, nowait, arguments)
|
800
840
|
ticket = 0
|
801
|
-
buffer =
|
841
|
+
buffer = ''
|
802
842
|
buffer << @packed_indexes
|
803
843
|
buffer << [ticket].pack(PACK_UINT16)
|
804
844
|
buffer << exchange.to_s.bytesize.chr
|
@@ -815,6 +855,7 @@ module AMQ
|
|
815
855
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
816
856
|
MethodFrame.new(buffer, channel)
|
817
857
|
end
|
858
|
+
|
818
859
|
end
|
819
860
|
|
820
861
|
class DeclareOk < Protocol::Method
|
@@ -835,6 +876,8 @@ module AMQ
|
|
835
876
|
def self.has_content?
|
836
877
|
false
|
837
878
|
end
|
879
|
+
|
880
|
+
|
838
881
|
end
|
839
882
|
|
840
883
|
class Delete < Protocol::Method
|
@@ -843,15 +886,16 @@ module AMQ
|
|
843
886
|
@index = 0x00280014 # 40, 20, 2621460
|
844
887
|
@packed_indexes = [40, 20].pack(PACK_UINT16_X2).freeze
|
845
888
|
|
889
|
+
|
846
890
|
def self.has_content?
|
847
891
|
false
|
848
892
|
end
|
849
893
|
|
850
894
|
# @return
|
851
|
-
# [
|
895
|
+
# [u'ticket = 0', u'exchange = nil', u'if_unused = false', u'nowait = false']
|
852
896
|
def self.encode(channel, exchange, if_unused, nowait)
|
853
897
|
ticket = 0
|
854
|
-
buffer =
|
898
|
+
buffer = ''
|
855
899
|
buffer << @packed_indexes
|
856
900
|
buffer << [ticket].pack(PACK_UINT16)
|
857
901
|
buffer << exchange.to_s.bytesize.chr
|
@@ -862,6 +906,7 @@ module AMQ
|
|
862
906
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
863
907
|
MethodFrame.new(buffer, channel)
|
864
908
|
end
|
909
|
+
|
865
910
|
end
|
866
911
|
|
867
912
|
class DeleteOk < Protocol::Method
|
@@ -882,6 +927,8 @@ module AMQ
|
|
882
927
|
def self.has_content?
|
883
928
|
false
|
884
929
|
end
|
930
|
+
|
931
|
+
|
885
932
|
end
|
886
933
|
|
887
934
|
class Bind < Protocol::Method
|
@@ -890,15 +937,16 @@ module AMQ
|
|
890
937
|
@index = 0x0028001E # 40, 30, 2621470
|
891
938
|
@packed_indexes = [40, 30].pack(PACK_UINT16_X2).freeze
|
892
939
|
|
940
|
+
|
893
941
|
def self.has_content?
|
894
942
|
false
|
895
943
|
end
|
896
944
|
|
897
945
|
# @return
|
898
|
-
# [
|
946
|
+
# [u'ticket = 0', u'destination = nil', u'source = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
899
947
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
900
948
|
ticket = 0
|
901
|
-
buffer =
|
949
|
+
buffer = ''
|
902
950
|
buffer << @packed_indexes
|
903
951
|
buffer << [ticket].pack(PACK_UINT16)
|
904
952
|
buffer << destination.to_s.bytesize.chr
|
@@ -913,6 +961,7 @@ module AMQ
|
|
913
961
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
914
962
|
MethodFrame.new(buffer, channel)
|
915
963
|
end
|
964
|
+
|
916
965
|
end
|
917
966
|
|
918
967
|
class BindOk < Protocol::Method
|
@@ -933,6 +982,8 @@ module AMQ
|
|
933
982
|
def self.has_content?
|
934
983
|
false
|
935
984
|
end
|
985
|
+
|
986
|
+
|
936
987
|
end
|
937
988
|
|
938
989
|
class Unbind < Protocol::Method
|
@@ -941,15 +992,16 @@ module AMQ
|
|
941
992
|
@index = 0x00280028 # 40, 40, 2621480
|
942
993
|
@packed_indexes = [40, 40].pack(PACK_UINT16_X2).freeze
|
943
994
|
|
995
|
+
|
944
996
|
def self.has_content?
|
945
997
|
false
|
946
998
|
end
|
947
999
|
|
948
1000
|
# @return
|
949
|
-
# [
|
1001
|
+
# [u'ticket = 0', u'destination = nil', u'source = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
950
1002
|
def self.encode(channel, destination, source, routing_key, nowait, arguments)
|
951
1003
|
ticket = 0
|
952
|
-
buffer =
|
1004
|
+
buffer = ''
|
953
1005
|
buffer << @packed_indexes
|
954
1006
|
buffer << [ticket].pack(PACK_UINT16)
|
955
1007
|
buffer << destination.to_s.bytesize.chr
|
@@ -964,6 +1016,7 @@ module AMQ
|
|
964
1016
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
965
1017
|
MethodFrame.new(buffer, channel)
|
966
1018
|
end
|
1019
|
+
|
967
1020
|
end
|
968
1021
|
|
969
1022
|
class UnbindOk < Protocol::Method
|
@@ -984,28 +1037,34 @@ module AMQ
|
|
984
1037
|
def self.has_content?
|
985
1038
|
false
|
986
1039
|
end
|
1040
|
+
|
1041
|
+
|
987
1042
|
end
|
1043
|
+
|
988
1044
|
end
|
989
1045
|
|
990
1046
|
class Queue < Protocol::Class
|
991
1047
|
@name = "queue"
|
992
1048
|
@method_id = 50
|
993
1049
|
|
1050
|
+
|
1051
|
+
|
994
1052
|
class Declare < Protocol::Method
|
995
1053
|
@name = "queue.declare"
|
996
1054
|
@method_id = 10
|
997
1055
|
@index = 0x0032000A # 50, 10, 3276810
|
998
1056
|
@packed_indexes = [50, 10].pack(PACK_UINT16_X2).freeze
|
999
1057
|
|
1058
|
+
|
1000
1059
|
def self.has_content?
|
1001
1060
|
false
|
1002
1061
|
end
|
1003
1062
|
|
1004
1063
|
# @return
|
1005
|
-
# [
|
1064
|
+
# [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 = {}']
|
1006
1065
|
def self.encode(channel, queue, passive, durable, exclusive, auto_delete, nowait, arguments)
|
1007
1066
|
ticket = 0
|
1008
|
-
buffer =
|
1067
|
+
buffer = ''
|
1009
1068
|
buffer << @packed_indexes
|
1010
1069
|
buffer << [ticket].pack(PACK_UINT16)
|
1011
1070
|
buffer << queue.to_s.bytesize.chr
|
@@ -1020,6 +1079,7 @@ module AMQ
|
|
1020
1079
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1021
1080
|
MethodFrame.new(buffer, channel)
|
1022
1081
|
end
|
1082
|
+
|
1023
1083
|
end
|
1024
1084
|
|
1025
1085
|
class DeclareOk < Protocol::Method
|
@@ -1052,6 +1112,8 @@ module AMQ
|
|
1052
1112
|
def self.has_content?
|
1053
1113
|
false
|
1054
1114
|
end
|
1115
|
+
|
1116
|
+
|
1055
1117
|
end
|
1056
1118
|
|
1057
1119
|
class Bind < Protocol::Method
|
@@ -1060,15 +1122,16 @@ module AMQ
|
|
1060
1122
|
@index = 0x00320014 # 50, 20, 3276820
|
1061
1123
|
@packed_indexes = [50, 20].pack(PACK_UINT16_X2).freeze
|
1062
1124
|
|
1125
|
+
|
1063
1126
|
def self.has_content?
|
1064
1127
|
false
|
1065
1128
|
end
|
1066
1129
|
|
1067
1130
|
# @return
|
1068
|
-
# [
|
1131
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'exchange = nil', u'routing_key = EMPTY_STRING', u'nowait = false', u'arguments = {}']
|
1069
1132
|
def self.encode(channel, queue, exchange, routing_key, nowait, arguments)
|
1070
1133
|
ticket = 0
|
1071
|
-
buffer =
|
1134
|
+
buffer = ''
|
1072
1135
|
buffer << @packed_indexes
|
1073
1136
|
buffer << [ticket].pack(PACK_UINT16)
|
1074
1137
|
buffer << queue.to_s.bytesize.chr
|
@@ -1083,6 +1146,7 @@ module AMQ
|
|
1083
1146
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1084
1147
|
MethodFrame.new(buffer, channel)
|
1085
1148
|
end
|
1149
|
+
|
1086
1150
|
end
|
1087
1151
|
|
1088
1152
|
class BindOk < Protocol::Method
|
@@ -1103,6 +1167,8 @@ module AMQ
|
|
1103
1167
|
def self.has_content?
|
1104
1168
|
false
|
1105
1169
|
end
|
1170
|
+
|
1171
|
+
|
1106
1172
|
end
|
1107
1173
|
|
1108
1174
|
class Purge < Protocol::Method
|
@@ -1111,15 +1177,16 @@ module AMQ
|
|
1111
1177
|
@index = 0x0032001E # 50, 30, 3276830
|
1112
1178
|
@packed_indexes = [50, 30].pack(PACK_UINT16_X2).freeze
|
1113
1179
|
|
1180
|
+
|
1114
1181
|
def self.has_content?
|
1115
1182
|
false
|
1116
1183
|
end
|
1117
1184
|
|
1118
1185
|
# @return
|
1119
|
-
# [
|
1186
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'nowait = false']
|
1120
1187
|
def self.encode(channel, queue, nowait)
|
1121
1188
|
ticket = 0
|
1122
|
-
buffer =
|
1189
|
+
buffer = ''
|
1123
1190
|
buffer << @packed_indexes
|
1124
1191
|
buffer << [ticket].pack(PACK_UINT16)
|
1125
1192
|
buffer << queue.to_s.bytesize.chr
|
@@ -1129,6 +1196,7 @@ module AMQ
|
|
1129
1196
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1130
1197
|
MethodFrame.new(buffer, channel)
|
1131
1198
|
end
|
1199
|
+
|
1132
1200
|
end
|
1133
1201
|
|
1134
1202
|
class PurgeOk < Protocol::Method
|
@@ -1153,6 +1221,8 @@ module AMQ
|
|
1153
1221
|
def self.has_content?
|
1154
1222
|
false
|
1155
1223
|
end
|
1224
|
+
|
1225
|
+
|
1156
1226
|
end
|
1157
1227
|
|
1158
1228
|
class Delete < Protocol::Method
|
@@ -1161,15 +1231,16 @@ module AMQ
|
|
1161
1231
|
@index = 0x00320028 # 50, 40, 3276840
|
1162
1232
|
@packed_indexes = [50, 40].pack(PACK_UINT16_X2).freeze
|
1163
1233
|
|
1234
|
+
|
1164
1235
|
def self.has_content?
|
1165
1236
|
false
|
1166
1237
|
end
|
1167
1238
|
|
1168
1239
|
# @return
|
1169
|
-
# [
|
1240
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'if_unused = false', u'if_empty = false', u'nowait = false']
|
1170
1241
|
def self.encode(channel, queue, if_unused, if_empty, nowait)
|
1171
1242
|
ticket = 0
|
1172
|
-
buffer =
|
1243
|
+
buffer = ''
|
1173
1244
|
buffer << @packed_indexes
|
1174
1245
|
buffer << [ticket].pack(PACK_UINT16)
|
1175
1246
|
buffer << queue.to_s.bytesize.chr
|
@@ -1181,6 +1252,7 @@ module AMQ
|
|
1181
1252
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1182
1253
|
MethodFrame.new(buffer, channel)
|
1183
1254
|
end
|
1255
|
+
|
1184
1256
|
end
|
1185
1257
|
|
1186
1258
|
class DeleteOk < Protocol::Method
|
@@ -1205,6 +1277,8 @@ module AMQ
|
|
1205
1277
|
def self.has_content?
|
1206
1278
|
false
|
1207
1279
|
end
|
1280
|
+
|
1281
|
+
|
1208
1282
|
end
|
1209
1283
|
|
1210
1284
|
class Unbind < Protocol::Method
|
@@ -1213,15 +1287,16 @@ module AMQ
|
|
1213
1287
|
@index = 0x00320032 # 50, 50, 3276850
|
1214
1288
|
@packed_indexes = [50, 50].pack(PACK_UINT16_X2).freeze
|
1215
1289
|
|
1290
|
+
|
1216
1291
|
def self.has_content?
|
1217
1292
|
false
|
1218
1293
|
end
|
1219
1294
|
|
1220
1295
|
# @return
|
1221
|
-
# [
|
1296
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'exchange = nil', u'routing_key = EMPTY_STRING', u'arguments = {}']
|
1222
1297
|
def self.encode(channel, queue, exchange, routing_key, arguments)
|
1223
1298
|
ticket = 0
|
1224
|
-
buffer =
|
1299
|
+
buffer = ''
|
1225
1300
|
buffer << @packed_indexes
|
1226
1301
|
buffer << [ticket].pack(PACK_UINT16)
|
1227
1302
|
buffer << queue.to_s.bytesize.chr
|
@@ -1233,6 +1308,7 @@ module AMQ
|
|
1233
1308
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1234
1309
|
MethodFrame.new(buffer, channel)
|
1235
1310
|
end
|
1311
|
+
|
1236
1312
|
end
|
1237
1313
|
|
1238
1314
|
class UnbindOk < Protocol::Method
|
@@ -1253,7 +1329,10 @@ module AMQ
|
|
1253
1329
|
def self.has_content?
|
1254
1330
|
false
|
1255
1331
|
end
|
1332
|
+
|
1333
|
+
|
1256
1334
|
end
|
1335
|
+
|
1257
1336
|
end
|
1258
1337
|
|
1259
1338
|
class Basic < Protocol::Class
|
@@ -1279,7 +1358,7 @@ module AMQ
|
|
1279
1358
|
|
1280
1359
|
# 1 << 15
|
1281
1360
|
def self.encode_content_type(value)
|
1282
|
-
buffer =
|
1361
|
+
buffer = ''
|
1283
1362
|
buffer << value.to_s.bytesize.chr
|
1284
1363
|
buffer << value.to_s
|
1285
1364
|
[0, 0x8000, buffer]
|
@@ -1287,7 +1366,7 @@ module AMQ
|
|
1287
1366
|
|
1288
1367
|
# 1 << 14
|
1289
1368
|
def self.encode_content_encoding(value)
|
1290
|
-
buffer =
|
1369
|
+
buffer = ''
|
1291
1370
|
buffer << value.to_s.bytesize.chr
|
1292
1371
|
buffer << value.to_s
|
1293
1372
|
[1, 0x4000, buffer]
|
@@ -1295,28 +1374,28 @@ module AMQ
|
|
1295
1374
|
|
1296
1375
|
# 1 << 13
|
1297
1376
|
def self.encode_headers(value)
|
1298
|
-
buffer =
|
1377
|
+
buffer = ''
|
1299
1378
|
buffer << AMQ::Protocol::Table.encode(value)
|
1300
1379
|
[2, 0x2000, buffer]
|
1301
1380
|
end
|
1302
1381
|
|
1303
1382
|
# 1 << 12
|
1304
1383
|
def self.encode_delivery_mode(value)
|
1305
|
-
buffer =
|
1384
|
+
buffer = ''
|
1306
1385
|
buffer << [value].pack(PACK_CHAR)
|
1307
1386
|
[3, 0x1000, buffer]
|
1308
1387
|
end
|
1309
1388
|
|
1310
1389
|
# 1 << 11
|
1311
1390
|
def self.encode_priority(value)
|
1312
|
-
buffer =
|
1391
|
+
buffer = ''
|
1313
1392
|
buffer << [value].pack(PACK_CHAR)
|
1314
1393
|
[4, 0x0800, buffer]
|
1315
1394
|
end
|
1316
1395
|
|
1317
1396
|
# 1 << 10
|
1318
1397
|
def self.encode_correlation_id(value)
|
1319
|
-
buffer =
|
1398
|
+
buffer = ''
|
1320
1399
|
buffer << value.to_s.bytesize.chr
|
1321
1400
|
buffer << value.to_s
|
1322
1401
|
[5, 0x0400, buffer]
|
@@ -1324,7 +1403,7 @@ module AMQ
|
|
1324
1403
|
|
1325
1404
|
# 1 << 9
|
1326
1405
|
def self.encode_reply_to(value)
|
1327
|
-
buffer =
|
1406
|
+
buffer = ''
|
1328
1407
|
buffer << value.to_s.bytesize.chr
|
1329
1408
|
buffer << value.to_s
|
1330
1409
|
[6, 0x0200, buffer]
|
@@ -1332,7 +1411,7 @@ module AMQ
|
|
1332
1411
|
|
1333
1412
|
# 1 << 8
|
1334
1413
|
def self.encode_expiration(value)
|
1335
|
-
buffer =
|
1414
|
+
buffer = ''
|
1336
1415
|
buffer << value.to_s.bytesize.chr
|
1337
1416
|
buffer << value.to_s
|
1338
1417
|
[7, 0x0100, buffer]
|
@@ -1340,7 +1419,7 @@ module AMQ
|
|
1340
1419
|
|
1341
1420
|
# 1 << 7
|
1342
1421
|
def self.encode_message_id(value)
|
1343
|
-
buffer =
|
1422
|
+
buffer = ''
|
1344
1423
|
buffer << value.to_s.bytesize.chr
|
1345
1424
|
buffer << value.to_s
|
1346
1425
|
[8, 0x0080, buffer]
|
@@ -1348,14 +1427,14 @@ module AMQ
|
|
1348
1427
|
|
1349
1428
|
# 1 << 6
|
1350
1429
|
def self.encode_timestamp(value)
|
1351
|
-
buffer =
|
1430
|
+
buffer = ''
|
1352
1431
|
buffer << AMQ::Hacks.pack_64_big_endian(value)
|
1353
1432
|
[9, 0x0040, buffer]
|
1354
1433
|
end
|
1355
1434
|
|
1356
1435
|
# 1 << 5
|
1357
1436
|
def self.encode_type(value)
|
1358
|
-
buffer =
|
1437
|
+
buffer = ''
|
1359
1438
|
buffer << value.to_s.bytesize.chr
|
1360
1439
|
buffer << value.to_s
|
1361
1440
|
[10, 0x0020, buffer]
|
@@ -1363,7 +1442,7 @@ module AMQ
|
|
1363
1442
|
|
1364
1443
|
# 1 << 4
|
1365
1444
|
def self.encode_user_id(value)
|
1366
|
-
buffer =
|
1445
|
+
buffer = ''
|
1367
1446
|
buffer << value.to_s.bytesize.chr
|
1368
1447
|
buffer << value.to_s
|
1369
1448
|
[11, 0x0010, buffer]
|
@@ -1371,7 +1450,7 @@ module AMQ
|
|
1371
1450
|
|
1372
1451
|
# 1 << 3
|
1373
1452
|
def self.encode_app_id(value)
|
1374
|
-
buffer =
|
1453
|
+
buffer = ''
|
1375
1454
|
buffer << value.to_s.bytesize.chr
|
1376
1455
|
buffer << value.to_s
|
1377
1456
|
[12, 0x0008, buffer]
|
@@ -1379,12 +1458,14 @@ module AMQ
|
|
1379
1458
|
|
1380
1459
|
# 1 << 2
|
1381
1460
|
def self.encode_cluster_id(value)
|
1382
|
-
buffer =
|
1461
|
+
buffer = ''
|
1383
1462
|
buffer << value.to_s.bytesize.chr
|
1384
1463
|
buffer << value.to_s
|
1385
1464
|
[13, 0x0004, buffer]
|
1386
1465
|
end
|
1387
1466
|
|
1467
|
+
|
1468
|
+
|
1388
1469
|
def self.encode_properties(body_size, properties)
|
1389
1470
|
pieces, flags = [], 0
|
1390
1471
|
|
@@ -1394,7 +1475,7 @@ module AMQ
|
|
1394
1475
|
pieces[i] = result
|
1395
1476
|
end
|
1396
1477
|
|
1397
|
-
# result = [60, 0, body_size, flags].pack(
|
1478
|
+
# result = [60, 0, body_size, flags].pack('n2Qn')
|
1398
1479
|
result = [60, 0].pack(PACK_UINT16_X2)
|
1399
1480
|
result += AMQ::Hacks.pack_64_big_endian(body_size)
|
1400
1481
|
result += [flags].pack(PACK_UINT16)
|
@@ -1436,7 +1517,7 @@ module AMQ
|
|
1436
1517
|
0x0004 => :shortstr,
|
1437
1518
|
}
|
1438
1519
|
|
1439
|
-
# Hash doesn
|
1520
|
+
# Hash doesn't give any guarantees on keys order, we will do it in a
|
1440
1521
|
# straightforward way
|
1441
1522
|
DECODE_PROPERTIES_KEYS = [
|
1442
1523
|
0x8000,
|
@@ -1494,14 +1575,15 @@ module AMQ
|
|
1494
1575
|
@index = 0x003C000A # 60, 10, 3932170
|
1495
1576
|
@packed_indexes = [60, 10].pack(PACK_UINT16_X2).freeze
|
1496
1577
|
|
1578
|
+
|
1497
1579
|
def self.has_content?
|
1498
1580
|
false
|
1499
1581
|
end
|
1500
1582
|
|
1501
1583
|
# @return
|
1502
|
-
# [
|
1584
|
+
# [u'prefetch_size = false', u'prefetch_count = false', u'global = false']
|
1503
1585
|
def self.encode(channel, prefetch_size, prefetch_count, global)
|
1504
|
-
buffer =
|
1586
|
+
buffer = ''
|
1505
1587
|
buffer << @packed_indexes
|
1506
1588
|
buffer << [prefetch_size].pack(PACK_UINT32)
|
1507
1589
|
buffer << [prefetch_count].pack(PACK_UINT16)
|
@@ -1510,6 +1592,7 @@ module AMQ
|
|
1510
1592
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1511
1593
|
MethodFrame.new(buffer, channel)
|
1512
1594
|
end
|
1595
|
+
|
1513
1596
|
end
|
1514
1597
|
|
1515
1598
|
class QosOk < Protocol::Method
|
@@ -1530,6 +1613,8 @@ module AMQ
|
|
1530
1613
|
def self.has_content?
|
1531
1614
|
false
|
1532
1615
|
end
|
1616
|
+
|
1617
|
+
|
1533
1618
|
end
|
1534
1619
|
|
1535
1620
|
class Consume < Protocol::Method
|
@@ -1538,15 +1623,16 @@ module AMQ
|
|
1538
1623
|
@index = 0x003C0014 # 60, 20, 3932180
|
1539
1624
|
@packed_indexes = [60, 20].pack(PACK_UINT16_X2).freeze
|
1540
1625
|
|
1626
|
+
|
1541
1627
|
def self.has_content?
|
1542
1628
|
false
|
1543
1629
|
end
|
1544
1630
|
|
1545
1631
|
# @return
|
1546
|
-
# [
|
1632
|
+
# [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 = {}']
|
1547
1633
|
def self.encode(channel, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments)
|
1548
1634
|
ticket = 0
|
1549
|
-
buffer =
|
1635
|
+
buffer = ''
|
1550
1636
|
buffer << @packed_indexes
|
1551
1637
|
buffer << [ticket].pack(PACK_UINT16)
|
1552
1638
|
buffer << queue.to_s.bytesize.chr
|
@@ -1562,6 +1648,7 @@ module AMQ
|
|
1562
1648
|
buffer << AMQ::Protocol::Table.encode(arguments)
|
1563
1649
|
MethodFrame.new(buffer, channel)
|
1564
1650
|
end
|
1651
|
+
|
1565
1652
|
end
|
1566
1653
|
|
1567
1654
|
class ConsumeOk < Protocol::Method
|
@@ -1588,6 +1675,8 @@ module AMQ
|
|
1588
1675
|
def self.has_content?
|
1589
1676
|
false
|
1590
1677
|
end
|
1678
|
+
|
1679
|
+
|
1591
1680
|
end
|
1592
1681
|
|
1593
1682
|
class Cancel < Protocol::Method
|
@@ -1620,9 +1709,9 @@ module AMQ
|
|
1620
1709
|
end
|
1621
1710
|
|
1622
1711
|
# @return
|
1623
|
-
# [
|
1712
|
+
# [u'consumer_tag = nil', u'nowait = false']
|
1624
1713
|
def self.encode(channel, consumer_tag, nowait)
|
1625
|
-
buffer =
|
1714
|
+
buffer = ''
|
1626
1715
|
buffer << @packed_indexes
|
1627
1716
|
buffer << consumer_tag.to_s.bytesize.chr
|
1628
1717
|
buffer << consumer_tag.to_s
|
@@ -1631,6 +1720,7 @@ module AMQ
|
|
1631
1720
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1632
1721
|
MethodFrame.new(buffer, channel)
|
1633
1722
|
end
|
1723
|
+
|
1634
1724
|
end
|
1635
1725
|
|
1636
1726
|
class CancelOk < Protocol::Method
|
@@ -1657,6 +1747,8 @@ module AMQ
|
|
1657
1747
|
def self.has_content?
|
1658
1748
|
false
|
1659
1749
|
end
|
1750
|
+
|
1751
|
+
|
1660
1752
|
end
|
1661
1753
|
|
1662
1754
|
class Publish < Protocol::Method
|
@@ -1665,15 +1757,16 @@ module AMQ
|
|
1665
1757
|
@index = 0x003C0028 # 60, 40, 3932200
|
1666
1758
|
@packed_indexes = [60, 40].pack(PACK_UINT16_X2).freeze
|
1667
1759
|
|
1760
|
+
|
1668
1761
|
def self.has_content?
|
1669
1762
|
true
|
1670
1763
|
end
|
1671
1764
|
|
1672
1765
|
# @return
|
1673
|
-
# [
|
1766
|
+
# [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']
|
1674
1767
|
def self.encode(channel, payload, user_headers, exchange, routing_key, mandatory, immediate, frame_size)
|
1675
1768
|
ticket = 0
|
1676
|
-
buffer =
|
1769
|
+
buffer = ''
|
1677
1770
|
buffer << @packed_indexes
|
1678
1771
|
buffer << [ticket].pack(PACK_UINT16)
|
1679
1772
|
buffer << exchange.to_s.bytesize.chr
|
@@ -1694,6 +1787,7 @@ module AMQ
|
|
1694
1787
|
frames << HeaderFrame.new(properties_payload, channel)
|
1695
1788
|
frames + self.encode_body(payload, channel, frame_size)
|
1696
1789
|
end
|
1790
|
+
|
1697
1791
|
end
|
1698
1792
|
|
1699
1793
|
class Return < Protocol::Method
|
@@ -1733,6 +1827,8 @@ module AMQ
|
|
1733
1827
|
def self.has_content?
|
1734
1828
|
true
|
1735
1829
|
end
|
1830
|
+
|
1831
|
+
|
1736
1832
|
end
|
1737
1833
|
|
1738
1834
|
class Deliver < Protocol::Method
|
@@ -1776,6 +1872,8 @@ module AMQ
|
|
1776
1872
|
def self.has_content?
|
1777
1873
|
true
|
1778
1874
|
end
|
1875
|
+
|
1876
|
+
|
1779
1877
|
end
|
1780
1878
|
|
1781
1879
|
class Get < Protocol::Method
|
@@ -1784,15 +1882,16 @@ module AMQ
|
|
1784
1882
|
@index = 0x003C0046 # 60, 70, 3932230
|
1785
1883
|
@packed_indexes = [60, 70].pack(PACK_UINT16_X2).freeze
|
1786
1884
|
|
1885
|
+
|
1787
1886
|
def self.has_content?
|
1788
1887
|
false
|
1789
1888
|
end
|
1790
1889
|
|
1791
1890
|
# @return
|
1792
|
-
# [
|
1891
|
+
# [u'ticket = 0', u'queue = EMPTY_STRING', u'no_ack = false']
|
1793
1892
|
def self.encode(channel, queue, no_ack)
|
1794
1893
|
ticket = 0
|
1795
|
-
buffer =
|
1894
|
+
buffer = ''
|
1796
1895
|
buffer << @packed_indexes
|
1797
1896
|
buffer << [ticket].pack(PACK_UINT16)
|
1798
1897
|
buffer << queue.to_s.bytesize.chr
|
@@ -1802,6 +1901,7 @@ module AMQ
|
|
1802
1901
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1803
1902
|
MethodFrame.new(buffer, channel)
|
1804
1903
|
end
|
1904
|
+
|
1805
1905
|
end
|
1806
1906
|
|
1807
1907
|
class GetOk < Protocol::Method
|
@@ -1843,6 +1943,8 @@ module AMQ
|
|
1843
1943
|
def self.has_content?
|
1844
1944
|
true
|
1845
1945
|
end
|
1946
|
+
|
1947
|
+
|
1846
1948
|
end
|
1847
1949
|
|
1848
1950
|
class GetEmpty < Protocol::Method
|
@@ -1869,6 +1971,8 @@ module AMQ
|
|
1869
1971
|
def self.has_content?
|
1870
1972
|
false
|
1871
1973
|
end
|
1974
|
+
|
1975
|
+
|
1872
1976
|
end
|
1873
1977
|
|
1874
1978
|
class Ack < Protocol::Method
|
@@ -1899,9 +2003,9 @@ module AMQ
|
|
1899
2003
|
end
|
1900
2004
|
|
1901
2005
|
# @return
|
1902
|
-
# [
|
2006
|
+
# [u'delivery_tag = false', u'multiple = false']
|
1903
2007
|
def self.encode(channel, delivery_tag, multiple)
|
1904
|
-
buffer =
|
2008
|
+
buffer = ''
|
1905
2009
|
buffer << @packed_indexes
|
1906
2010
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
1907
2011
|
bit_buffer = 0
|
@@ -1909,6 +2013,7 @@ module AMQ
|
|
1909
2013
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1910
2014
|
MethodFrame.new(buffer, channel)
|
1911
2015
|
end
|
2016
|
+
|
1912
2017
|
end
|
1913
2018
|
|
1914
2019
|
class Reject < Protocol::Method
|
@@ -1917,14 +2022,15 @@ module AMQ
|
|
1917
2022
|
@index = 0x003C005A # 60, 90, 3932250
|
1918
2023
|
@packed_indexes = [60, 90].pack(PACK_UINT16_X2).freeze
|
1919
2024
|
|
2025
|
+
|
1920
2026
|
def self.has_content?
|
1921
2027
|
false
|
1922
2028
|
end
|
1923
2029
|
|
1924
2030
|
# @return
|
1925
|
-
# [
|
2031
|
+
# [u'delivery_tag = nil', u'requeue = true']
|
1926
2032
|
def self.encode(channel, delivery_tag, requeue)
|
1927
|
-
buffer =
|
2033
|
+
buffer = ''
|
1928
2034
|
buffer << @packed_indexes
|
1929
2035
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
1930
2036
|
bit_buffer = 0
|
@@ -1932,6 +2038,7 @@ module AMQ
|
|
1932
2038
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1933
2039
|
MethodFrame.new(buffer, channel)
|
1934
2040
|
end
|
2041
|
+
|
1935
2042
|
end
|
1936
2043
|
|
1937
2044
|
class RecoverAsync < Protocol::Method
|
@@ -1940,20 +2047,22 @@ module AMQ
|
|
1940
2047
|
@index = 0x003C0064 # 60, 100, 3932260
|
1941
2048
|
@packed_indexes = [60, 100].pack(PACK_UINT16_X2).freeze
|
1942
2049
|
|
2050
|
+
|
1943
2051
|
def self.has_content?
|
1944
2052
|
false
|
1945
2053
|
end
|
1946
2054
|
|
1947
2055
|
# @return
|
1948
|
-
# [
|
2056
|
+
# [u'requeue = false']
|
1949
2057
|
def self.encode(channel, requeue)
|
1950
|
-
buffer =
|
2058
|
+
buffer = ''
|
1951
2059
|
buffer << @packed_indexes
|
1952
2060
|
bit_buffer = 0
|
1953
2061
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
1954
2062
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1955
2063
|
MethodFrame.new(buffer, channel)
|
1956
2064
|
end
|
2065
|
+
|
1957
2066
|
end
|
1958
2067
|
|
1959
2068
|
class Recover < Protocol::Method
|
@@ -1962,20 +2071,22 @@ module AMQ
|
|
1962
2071
|
@index = 0x003C006E # 60, 110, 3932270
|
1963
2072
|
@packed_indexes = [60, 110].pack(PACK_UINT16_X2).freeze
|
1964
2073
|
|
2074
|
+
|
1965
2075
|
def self.has_content?
|
1966
2076
|
false
|
1967
2077
|
end
|
1968
2078
|
|
1969
2079
|
# @return
|
1970
|
-
# [
|
2080
|
+
# [u'requeue = false']
|
1971
2081
|
def self.encode(channel, requeue)
|
1972
|
-
buffer =
|
2082
|
+
buffer = ''
|
1973
2083
|
buffer << @packed_indexes
|
1974
2084
|
bit_buffer = 0
|
1975
2085
|
bit_buffer = bit_buffer | (1 << 0) if requeue
|
1976
2086
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
1977
2087
|
MethodFrame.new(buffer, channel)
|
1978
2088
|
end
|
2089
|
+
|
1979
2090
|
end
|
1980
2091
|
|
1981
2092
|
class RecoverOk < Protocol::Method
|
@@ -1996,6 +2107,8 @@ module AMQ
|
|
1996
2107
|
def self.has_content?
|
1997
2108
|
false
|
1998
2109
|
end
|
2110
|
+
|
2111
|
+
|
1999
2112
|
end
|
2000
2113
|
|
2001
2114
|
class Nack < Protocol::Method
|
@@ -2028,9 +2141,9 @@ module AMQ
|
|
2028
2141
|
end
|
2029
2142
|
|
2030
2143
|
# @return
|
2031
|
-
# [
|
2144
|
+
# [u'delivery_tag = false', u'multiple = false', u'requeue = true']
|
2032
2145
|
def self.encode(channel, delivery_tag, multiple, requeue)
|
2033
|
-
buffer =
|
2146
|
+
buffer = ''
|
2034
2147
|
buffer << @packed_indexes
|
2035
2148
|
buffer << AMQ::Hacks.pack_64_big_endian(delivery_tag)
|
2036
2149
|
bit_buffer = 0
|
@@ -2039,19 +2152,24 @@ module AMQ
|
|
2039
2152
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2040
2153
|
MethodFrame.new(buffer, channel)
|
2041
2154
|
end
|
2155
|
+
|
2042
2156
|
end
|
2157
|
+
|
2043
2158
|
end
|
2044
2159
|
|
2045
2160
|
class Tx < Protocol::Class
|
2046
2161
|
@name = "tx"
|
2047
2162
|
@method_id = 90
|
2048
2163
|
|
2164
|
+
|
2165
|
+
|
2049
2166
|
class Select < Protocol::Method
|
2050
2167
|
@name = "tx.select"
|
2051
2168
|
@method_id = 10
|
2052
2169
|
@index = 0x005A000A # 90, 10, 5898250
|
2053
2170
|
@packed_indexes = [90, 10].pack(PACK_UINT16_X2).freeze
|
2054
2171
|
|
2172
|
+
|
2055
2173
|
def self.has_content?
|
2056
2174
|
false
|
2057
2175
|
end
|
@@ -2059,10 +2177,11 @@ module AMQ
|
|
2059
2177
|
# @return
|
2060
2178
|
# []
|
2061
2179
|
def self.encode(channel)
|
2062
|
-
buffer =
|
2180
|
+
buffer = ''
|
2063
2181
|
buffer << @packed_indexes
|
2064
2182
|
MethodFrame.new(buffer, channel)
|
2065
2183
|
end
|
2184
|
+
|
2066
2185
|
end
|
2067
2186
|
|
2068
2187
|
class SelectOk < Protocol::Method
|
@@ -2083,6 +2202,8 @@ module AMQ
|
|
2083
2202
|
def self.has_content?
|
2084
2203
|
false
|
2085
2204
|
end
|
2205
|
+
|
2206
|
+
|
2086
2207
|
end
|
2087
2208
|
|
2088
2209
|
class Commit < Protocol::Method
|
@@ -2091,6 +2212,7 @@ module AMQ
|
|
2091
2212
|
@index = 0x005A0014 # 90, 20, 5898260
|
2092
2213
|
@packed_indexes = [90, 20].pack(PACK_UINT16_X2).freeze
|
2093
2214
|
|
2215
|
+
|
2094
2216
|
def self.has_content?
|
2095
2217
|
false
|
2096
2218
|
end
|
@@ -2098,10 +2220,11 @@ module AMQ
|
|
2098
2220
|
# @return
|
2099
2221
|
# []
|
2100
2222
|
def self.encode(channel)
|
2101
|
-
buffer =
|
2223
|
+
buffer = ''
|
2102
2224
|
buffer << @packed_indexes
|
2103
2225
|
MethodFrame.new(buffer, channel)
|
2104
2226
|
end
|
2227
|
+
|
2105
2228
|
end
|
2106
2229
|
|
2107
2230
|
class CommitOk < Protocol::Method
|
@@ -2122,6 +2245,8 @@ module AMQ
|
|
2122
2245
|
def self.has_content?
|
2123
2246
|
false
|
2124
2247
|
end
|
2248
|
+
|
2249
|
+
|
2125
2250
|
end
|
2126
2251
|
|
2127
2252
|
class Rollback < Protocol::Method
|
@@ -2130,6 +2255,7 @@ module AMQ
|
|
2130
2255
|
@index = 0x005A001E # 90, 30, 5898270
|
2131
2256
|
@packed_indexes = [90, 30].pack(PACK_UINT16_X2).freeze
|
2132
2257
|
|
2258
|
+
|
2133
2259
|
def self.has_content?
|
2134
2260
|
false
|
2135
2261
|
end
|
@@ -2137,10 +2263,11 @@ module AMQ
|
|
2137
2263
|
# @return
|
2138
2264
|
# []
|
2139
2265
|
def self.encode(channel)
|
2140
|
-
buffer =
|
2266
|
+
buffer = ''
|
2141
2267
|
buffer << @packed_indexes
|
2142
2268
|
MethodFrame.new(buffer, channel)
|
2143
2269
|
end
|
2270
|
+
|
2144
2271
|
end
|
2145
2272
|
|
2146
2273
|
class RollbackOk < Protocol::Method
|
@@ -2161,13 +2288,18 @@ module AMQ
|
|
2161
2288
|
def self.has_content?
|
2162
2289
|
false
|
2163
2290
|
end
|
2291
|
+
|
2292
|
+
|
2164
2293
|
end
|
2294
|
+
|
2165
2295
|
end
|
2166
2296
|
|
2167
2297
|
class Confirm < Protocol::Class
|
2168
2298
|
@name = "confirm"
|
2169
2299
|
@method_id = 85
|
2170
2300
|
|
2301
|
+
|
2302
|
+
|
2171
2303
|
class Select < Protocol::Method
|
2172
2304
|
@name = "confirm.select"
|
2173
2305
|
@method_id = 10
|
@@ -2193,15 +2325,16 @@ module AMQ
|
|
2193
2325
|
end
|
2194
2326
|
|
2195
2327
|
# @return
|
2196
|
-
# [
|
2328
|
+
# [u'nowait = false']
|
2197
2329
|
def self.encode(channel, nowait)
|
2198
|
-
buffer =
|
2330
|
+
buffer = ''
|
2199
2331
|
buffer << @packed_indexes
|
2200
2332
|
bit_buffer = 0
|
2201
2333
|
bit_buffer = bit_buffer | (1 << 0) if nowait
|
2202
2334
|
buffer << [bit_buffer].pack(PACK_CHAR)
|
2203
2335
|
MethodFrame.new(buffer, channel)
|
2204
2336
|
end
|
2337
|
+
|
2205
2338
|
end
|
2206
2339
|
|
2207
2340
|
class SelectOk < Protocol::Method
|
@@ -2226,13 +2359,16 @@ module AMQ
|
|
2226
2359
|
# @return
|
2227
2360
|
# []
|
2228
2361
|
def self.encode(channel)
|
2229
|
-
buffer =
|
2362
|
+
buffer = ''
|
2230
2363
|
buffer << @packed_indexes
|
2231
2364
|
MethodFrame.new(buffer, channel)
|
2232
2365
|
end
|
2366
|
+
|
2233
2367
|
end
|
2368
|
+
|
2234
2369
|
end
|
2235
2370
|
|
2371
|
+
|
2236
2372
|
METHODS = begin
|
2237
2373
|
Method.methods.inject(Hash.new) do |hash, klass|
|
2238
2374
|
hash.merge!(klass.index => klass)
|
@@ -2240,3 +2376,4 @@ module AMQ
|
|
2240
2376
|
end
|
2241
2377
|
end
|
2242
2378
|
end
|
2379
|
+
|