amq-protocol 2.2.0 → 2.3.2
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.
- checksums.yaml +5 -5
- data/.rspec +1 -3
- data/.travis.yml +5 -5
- data/ChangeLog.md +37 -1
- data/Gemfile +6 -2
- data/README.md +7 -6
- data/amq-protocol.gemspec +1 -3
- data/lib/amq/protocol/client.rb +103 -30
- data/lib/amq/protocol/table_value_decoder.rb +1 -1
- data/lib/amq/protocol/table_value_encoder.rb +2 -2
- data/lib/amq/protocol/version.rb +1 -1
- data/lib/amq/settings.rb +31 -14
- data/lib/amq/uri.rb +69 -4
- data/spec/amq/bit_set_spec.rb +1 -6
- data/spec/amq/int_allocator_spec.rb +1 -4
- data/spec/amq/pack_spec.rb +45 -53
- data/spec/amq/protocol/basic_spec.rb +45 -48
- data/spec/amq/protocol/blank_body_encoding_spec.rb +1 -6
- data/spec/amq/protocol/channel_spec.rb +6 -9
- data/spec/amq/protocol/confirm_spec.rb +6 -9
- data/spec/amq/protocol/connection_spec.rb +22 -25
- data/spec/amq/protocol/constants_spec.rb +1 -5
- data/spec/amq/protocol/exchange_spec.rb +8 -11
- data/spec/amq/protocol/frame_spec.rb +1 -6
- data/spec/amq/protocol/method_spec.rb +2 -7
- data/spec/amq/protocol/queue_spec.rb +13 -16
- data/spec/amq/protocol/table_spec.rb +15 -10
- data/spec/amq/protocol/tx_spec.rb +7 -10
- data/spec/amq/protocol/value_decoder_spec.rb +6 -9
- data/spec/amq/protocol/value_encoder_spec.rb +1 -5
- data/spec/amq/protocol_spec.rb +1 -6
- data/spec/amq/settings_spec.rb +1 -4
- data/spec/amq/uri_parsing_spec.rb +253 -68
- data/spec/spec_helper.rb +5 -4
- metadata +4 -5
@@ -125,7 +125,7 @@ module AMQ
|
|
125
125
|
def self.decode_big_decimal(data, offset)
|
126
126
|
decimals, raw = data.slice(offset, 5).unpack(PACK_UCHAR_UINT32)
|
127
127
|
offset += 5
|
128
|
-
v = BigDecimal
|
128
|
+
v = BigDecimal(raw.to_s) * (BigDecimal(TEN) ** -decimals)
|
129
129
|
|
130
130
|
[v, offset]
|
131
131
|
end # self.decode_big_decimal(data, offset)
|
@@ -27,12 +27,12 @@ module AMQ
|
|
27
27
|
when String then
|
28
28
|
accumulator << TYPE_STRING
|
29
29
|
accumulator << [value.bytesize].pack(PACK_UINT32)
|
30
|
-
accumulator << value
|
30
|
+
accumulator << value.dup.force_encoding(accumulator.encoding)
|
31
31
|
when Symbol then
|
32
32
|
str = value.to_s
|
33
33
|
accumulator << TYPE_STRING
|
34
34
|
accumulator << [str.bytesize].pack(PACK_UINT32)
|
35
|
-
accumulator << str
|
35
|
+
accumulator << str.force_encoding(accumulator.encoding)
|
36
36
|
when Integer then
|
37
37
|
accumulator << TYPE_SIGNED_64BIT
|
38
38
|
accumulator << [value].pack(PACK_INT64_BE)
|
data/lib/amq/protocol/version.rb
CHANGED
data/lib/amq/settings.rb
CHANGED
@@ -14,24 +14,32 @@ module AMQ
|
|
14
14
|
# @see AMQ::Client::Settings.configure
|
15
15
|
def self.default
|
16
16
|
@default ||= {
|
17
|
-
#
|
18
|
-
:
|
19
|
-
:
|
17
|
+
# TCP/IP connection parameters
|
18
|
+
host: "127.0.0.1",
|
19
|
+
port: AMQ::Protocol::DEFAULT_PORT,
|
20
|
+
auth_mechanism: [],
|
20
21
|
|
21
|
-
#
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
22
|
+
# authentication parameters
|
23
|
+
user: "guest",
|
24
|
+
pass: "guest",
|
25
|
+
vhost: "/",
|
25
26
|
|
26
|
-
#
|
27
|
-
:
|
27
|
+
# client connection parameters
|
28
|
+
frame_max: (128 * 1024),
|
29
|
+
heartbeat: nil,
|
30
|
+
connection_timeout: nil,
|
31
|
+
channel_max: nil,
|
28
32
|
|
29
|
-
|
30
|
-
:
|
33
|
+
# ssl parameters
|
34
|
+
ssl: false,
|
35
|
+
verify: false,
|
36
|
+
fail_if_no_peer_cert: false,
|
37
|
+
cacertfile: nil,
|
38
|
+
certfile: nil,
|
39
|
+
keyfile: nil
|
31
40
|
}
|
32
41
|
end
|
33
42
|
|
34
|
-
|
35
43
|
# Merges given configuration parameters with defaults and returns
|
36
44
|
# the result.
|
37
45
|
#
|
@@ -43,9 +51,18 @@ module AMQ
|
|
43
51
|
# @option settings [String] :user ("guest") Username to use for authentication.
|
44
52
|
# @option settings [String] :pass ("guest") Password to use for authentication.
|
45
53
|
# @option settings [String] :ssl (false) Should be use TLS (SSL) for connection?
|
46
|
-
# @option settings [String] :timeout (nil) Connection timeout.
|
47
|
-
# @option settings [String] :broker (nil) Broker name (use if you intend to use broker-specific features).
|
48
54
|
# @option settings [Fixnum] :frame_max (131072) Maximum frame size to use. If broker cannot support frames this large, broker's maximum value will be used instead.
|
55
|
+
# @option settings [Integer] :heartbeat (nil) Heartbeat timeout value in seconds to negotiate with the server.
|
56
|
+
# @option settings [Integer] :connection_timeout (nil) Time in milliseconds to wait while establishing a TCP connection to the server before giving up.
|
57
|
+
# @option settings [Fixnum] :channel_max (nil) Maximum number of channels to permit on this connection.
|
58
|
+
# @option settings [Array] :auth_mechanism ([]) SASL authentication mechanisms to consider when negotiating a mechanism with the server. This parameter can be specified multiple times to specify multiple mechanisms, e.g. `?auth_mechanism=plain&auth_mechanism=amqplain`.
|
59
|
+
# @option settings [Boolean] :verify (false) Controls peer verification mode.
|
60
|
+
# @option settings [Boolean] :fail_if_no_peer_cert (false) When set to true, TLS connection will be rejected if client fails to provide a certificate.
|
61
|
+
# @option settings [String] :cacertfile (nil) Certificate Authority (CA) certificate file path.
|
62
|
+
# @option settings [String] :certfile (nil) Server certificate file path.
|
63
|
+
# @option settings [String] :keyfile (nil) Server private key file path.
|
64
|
+
#
|
65
|
+
# @option settings [String] :broker (nil) Broker name (use if you intend to use broker-specific features).
|
49
66
|
#
|
50
67
|
# @return [Hash] Merged configuration parameters.
|
51
68
|
def self.configure(settings = nil)
|
data/lib/amq/uri.rb
CHANGED
@@ -6,30 +6,95 @@ require "uri"
|
|
6
6
|
module AMQ
|
7
7
|
class URI
|
8
8
|
# @private
|
9
|
-
|
9
|
+
AMQP_DEFAULT_PORTS = {
|
10
|
+
"amqp" => 5672,
|
11
|
+
"amqps" => 5671
|
12
|
+
}.freeze
|
10
13
|
|
14
|
+
private_constant :AMQP_DEFAULT_PORTS
|
15
|
+
|
16
|
+
DEFAULTS = {
|
17
|
+
heartbeat: nil,
|
18
|
+
connection_timeout: nil,
|
19
|
+
channel_max: nil,
|
20
|
+
auth_mechanism: [],
|
21
|
+
verify: false,
|
22
|
+
fail_if_no_peer_cert: false,
|
23
|
+
cacertfile: nil,
|
24
|
+
certfile: nil,
|
25
|
+
keyfile: nil
|
26
|
+
}.freeze
|
11
27
|
|
12
28
|
def self.parse(connection_string)
|
13
29
|
uri = ::URI.parse(connection_string)
|
14
30
|
raise ArgumentError.new("Connection URI must use amqp or amqps schema (example: amqp://bus.megacorp.internal:5766), learn more at http://bit.ly/ks8MXK") unless %w{amqp amqps}.include?(uri.scheme)
|
15
31
|
|
16
|
-
opts =
|
32
|
+
opts = DEFAULTS.dup
|
17
33
|
|
18
34
|
opts[:scheme] = uri.scheme
|
19
35
|
opts[:user] = ::CGI::unescape(uri.user) if uri.user
|
20
36
|
opts[:pass] = ::CGI::unescape(uri.password) if uri.password
|
21
37
|
opts[:host] = uri.host if uri.host
|
22
|
-
opts[:port] = uri.port ||
|
23
|
-
opts[:ssl] = uri.scheme.to_s.downcase =~ /amqps/i
|
38
|
+
opts[:port] = uri.port || AMQP_DEFAULT_PORTS[uri.scheme]
|
39
|
+
opts[:ssl] = uri.scheme.to_s.downcase =~ /amqps/i # TODO: rename to tls
|
24
40
|
if uri.path =~ %r{^/(.*)}
|
25
41
|
raise ArgumentError.new("#{uri} has multiple-segment path; please percent-encode any slashes in the vhost name (e.g. /production => %2Fproduction). Learn more at http://bit.ly/amqp-gem-and-connection-uris") if $1.index('/')
|
26
42
|
opts[:vhost] = ::CGI::unescape($1)
|
27
43
|
end
|
28
44
|
|
45
|
+
if uri.query
|
46
|
+
query_params = CGI::parse(uri.query)
|
47
|
+
|
48
|
+
normalized_query_params = Hash[query_params.map { |param, value| [param, value.one? ? value.first : value] }]
|
49
|
+
|
50
|
+
opts[:heartbeat] = normalized_query_params["heartbeat"].to_i
|
51
|
+
opts[:connection_timeout] = normalized_query_params["connection_timeout"].to_i
|
52
|
+
opts[:channel_max] = normalized_query_params["channel_max"].to_i
|
53
|
+
opts[:auth_mechanism] = normalized_query_params["auth_mechanism"]
|
54
|
+
|
55
|
+
%w(cacertfile certfile keyfile).each do |tls_option|
|
56
|
+
if normalized_query_params[tls_option] && uri.scheme == "amqp"
|
57
|
+
raise ArgumentError.new("The option '#{tls_option}' can only be used in URIs that use amqps schema")
|
58
|
+
else
|
59
|
+
opts[tls_option.to_sym] = normalized_query_params[tls_option]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
%w(verify fail_if_no_peer_cert).each do |tls_option|
|
64
|
+
if normalized_query_params[tls_option] && uri.scheme == "amqp"
|
65
|
+
raise ArgumentError.new("The option '#{tls_option}' can only be used in URIs that use amqps schema")
|
66
|
+
else
|
67
|
+
opts[tls_option.to_sym] = as_boolean(normalized_query_params[tls_option])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
29
72
|
opts
|
30
73
|
end
|
74
|
+
|
31
75
|
def self.parse_amqp_url(s)
|
32
76
|
parse(s)
|
33
77
|
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Implementation
|
81
|
+
#
|
82
|
+
|
83
|
+
# Normalizes values returned by CGI.parse.
|
84
|
+
# @private
|
85
|
+
def self.as_boolean(val)
|
86
|
+
case val
|
87
|
+
when true then true
|
88
|
+
when false then false
|
89
|
+
when 1 then true
|
90
|
+
when 0 then false
|
91
|
+
when "true" then true
|
92
|
+
when "false" then false
|
93
|
+
else
|
94
|
+
!!val
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
private_class_method :as_boolean
|
34
99
|
end
|
35
100
|
end
|
data/spec/amq/bit_set_spec.rb
CHANGED
data/spec/amq/pack_spec.rb
CHANGED
@@ -1,76 +1,68 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
context "16-bit big-endian packing / unpacking" do
|
9
|
-
let(:examples_16bit) {
|
10
|
-
{
|
11
|
-
0x068D => "\x06\x8D" # 1677
|
12
|
-
}
|
3
|
+
RSpec.describe AMQ::Pack do
|
4
|
+
context "16-bit big-endian packing / unpacking" do
|
5
|
+
let(:examples_16bit) {
|
6
|
+
{
|
7
|
+
0x068D => "\x06\x8D" # 1677
|
13
8
|
}
|
9
|
+
}
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
11
|
+
it "unpacks signed integers from a string to a number" do
|
12
|
+
examples_16bit.each do |key, value|
|
13
|
+
expect(described_class.unpack_int16_big_endian(value)[0]).to eq(key)
|
19
14
|
end
|
20
15
|
end
|
16
|
+
end
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
0x0D15EA5EFEE1DEAD => "\x0D\x15\xEA\x5E\xFE\xE1\xDE\xAD",
|
34
|
-
0xDEADBEEFDEADBABE => "\xDE\xAD\xBE\xEF\xDE\xAD\xBA\xBE"
|
35
|
-
}
|
18
|
+
context "64-bit big-endian packing / unpacking" do
|
19
|
+
let(:examples) {
|
20
|
+
{
|
21
|
+
0x0000000000000000 => "\x00\x00\x00\x00\x00\x00\x00\x00",
|
22
|
+
0x000000000000000A => "\x00\x00\x00\x00\x00\x00\x00\x0A",
|
23
|
+
0x00000000000000A0 => "\x00\x00\x00\x00\x00\x00\x00\xA0",
|
24
|
+
0x000000000000B0A0 => "\x00\x00\x00\x00\x00\x00\xB0\xA0",
|
25
|
+
0x00000000000CB0AD => "\x00\x00\x00\x00\x00\x0C\xB0\xAD",
|
26
|
+
0x8BADF00DDEFEC8ED => "\x8B\xAD\xF0\x0D\xDE\xFE\xC8\xED",
|
27
|
+
0x0D15EA5EFEE1DEAD => "\x0D\x15\xEA\x5E\xFE\xE1\xDE\xAD",
|
28
|
+
0xDEADBEEFDEADBABE => "\xDE\xAD\xBE\xEF\xDE\xAD\xBA\xBE"
|
36
29
|
}
|
30
|
+
}
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
32
|
+
it "packs integers into big-endian string" do
|
33
|
+
examples.each do |key, value|
|
34
|
+
expect(described_class.pack_uint64_big_endian(key)).to eq(value)
|
42
35
|
end
|
36
|
+
end
|
43
37
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
38
|
+
it "should unpack string representation into integer" do
|
39
|
+
examples.each do |key, value|
|
40
|
+
expect(described_class.unpack_uint64_big_endian(value)[0]).to eq(key)
|
48
41
|
end
|
42
|
+
end
|
49
43
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
44
|
+
if RUBY_VERSION < '1.9'
|
45
|
+
describe "with utf encoding" do
|
46
|
+
before do
|
47
|
+
$KCODE = 'u'
|
48
|
+
end
|
55
49
|
|
56
|
-
|
57
|
-
|
58
|
-
|
50
|
+
after do
|
51
|
+
$KCODE = 'NONE'
|
52
|
+
end
|
59
53
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
54
|
+
it "packs integers into big-endian string" do
|
55
|
+
examples.each do |key, value|
|
56
|
+
expect(described_class.pack_uint64_big_endian(key)).to eq(value)
|
64
57
|
end
|
58
|
+
end
|
65
59
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
60
|
+
it "should unpack string representation into integer" do
|
61
|
+
examples.each do |key, value|
|
62
|
+
expect(described_class.unpack_uint64_big_endian(value)[0]).to eq(key)
|
70
63
|
end
|
71
64
|
end
|
72
65
|
end
|
73
|
-
|
74
66
|
end
|
75
67
|
end
|
76
68
|
end
|
@@ -1,42 +1,39 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
|
3
|
-
require File.expand_path('../../../spec_helper', __FILE__)
|
4
|
-
|
5
|
-
|
6
3
|
module AMQ
|
7
4
|
module Protocol
|
8
|
-
describe Basic do
|
5
|
+
RSpec.describe AMQ::Protocol::Basic do
|
9
6
|
describe '.encode_timestamp' do
|
10
7
|
it 'encodes the timestamp as a 64 byte big endian integer' do
|
11
8
|
expect(Basic.encode_timestamp(12345).last).to eq("\x00\x00\x00\x00\x00\x0009")
|
12
9
|
end
|
13
10
|
end
|
14
|
-
|
11
|
+
|
15
12
|
# describe '.decode_timestamp' do
|
16
13
|
# it 'decodes the timestamp from a 64 byte big endian integer and returns a Time object' do
|
17
14
|
# expect(Basic.decode_timestamp("\x00\x00\x00\x00\x00\x0009")).to eq(Time.at(12345))
|
18
15
|
# end
|
19
16
|
# end
|
20
|
-
|
17
|
+
|
21
18
|
describe '.encode_headers' do
|
22
19
|
it 'encodes the headers as a table' do
|
23
20
|
expect(Basic.encode_headers(:hello => 'world').last).to eq("\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world")
|
24
21
|
end
|
25
22
|
end
|
26
|
-
|
23
|
+
|
27
24
|
# describe '.decode_headers' do
|
28
25
|
# it 'decodes the headers from a table' do
|
29
26
|
# expect(Basic.decode_headers("\x00\x00\x00\x10\x05helloS\x00\x00\x00\x05world")).to eq({'hello' => 'world'})
|
30
27
|
# end
|
31
28
|
# end
|
32
|
-
|
29
|
+
|
33
30
|
describe '.encode_properties' do
|
34
31
|
it 'packs the parameters into a byte array using the other encode_* methods' do
|
35
32
|
result = Basic.encode_properties(10, {:priority => 0, :delivery_mode => 2, :content_type => 'application/octet-stream'})
|
36
33
|
expect(result).to eq("\x00<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0a\x98\x00\x18application/octet-stream\x02\x00")
|
37
34
|
end
|
38
35
|
end
|
39
|
-
|
36
|
+
|
40
37
|
describe '.decode_properties' do
|
41
38
|
it 'unpacks the properties from a byte array using the decode_* methods' do
|
42
39
|
result = Basic.decode_properties("\x98@\x18application/octet-stream\x02\x00\x00\x00\x00\x00\x00\x00\x00{")
|
@@ -48,7 +45,7 @@ module AMQ
|
|
48
45
|
expect(result).to eq({:priority => 0, :delivery_mode => 2, :content_type => 'application/octet-stream', :timestamp => Time.at(123), :headers => {'hello' => 'world'}})
|
49
46
|
end
|
50
47
|
end
|
51
|
-
|
48
|
+
|
52
49
|
%w(content_type content_encoding correlation_id reply_to expiration message_id type user_id app_id cluster_id).each do |method|
|
53
50
|
describe ".encode_#{method}" do
|
54
51
|
it 'encodes the parameter as a Pascal string' do
|
@@ -63,7 +60,7 @@ module AMQ
|
|
63
60
|
# end
|
64
61
|
# end
|
65
62
|
end
|
66
|
-
|
63
|
+
|
67
64
|
%w(delivery_mode priority).each do |method|
|
68
65
|
describe ".encode_#{method}" do
|
69
66
|
it 'encodes the parameter as a char' do
|
@@ -78,9 +75,9 @@ module AMQ
|
|
78
75
|
# end
|
79
76
|
end
|
80
77
|
end
|
81
|
-
|
78
|
+
|
82
79
|
class Basic
|
83
|
-
describe Qos do
|
80
|
+
RSpec.describe Qos do
|
84
81
|
describe '.encode' do
|
85
82
|
it 'encodes the parameters into a MethodFrame' do
|
86
83
|
channel = 1
|
@@ -94,12 +91,12 @@ module AMQ
|
|
94
91
|
end
|
95
92
|
end
|
96
93
|
|
97
|
-
# describe QosOk do
|
94
|
+
# RSpec.describe QosOk do
|
98
95
|
# describe '.decode' do
|
99
96
|
# end
|
100
97
|
# end
|
101
98
|
|
102
|
-
describe Consume do
|
99
|
+
RSpec.describe Consume do
|
103
100
|
describe '.encode' do
|
104
101
|
it 'encodes the parameters into a MethodFrame' do
|
105
102
|
channel = 1
|
@@ -116,18 +113,18 @@ module AMQ
|
|
116
113
|
end
|
117
114
|
end
|
118
115
|
end
|
119
|
-
|
120
|
-
describe ConsumeOk do
|
116
|
+
|
117
|
+
RSpec.describe ConsumeOk do
|
121
118
|
describe '.decode' do
|
122
119
|
subject do
|
123
120
|
ConsumeOk.decode("\x03foo")
|
124
121
|
end
|
125
|
-
|
122
|
+
|
126
123
|
its(:consumer_tag) { should eq('foo') }
|
127
124
|
end
|
128
125
|
end
|
129
126
|
|
130
|
-
describe Cancel do
|
127
|
+
RSpec.describe Cancel do
|
131
128
|
describe '.encode' do
|
132
129
|
it 'encodes the parameters into a MethodFrame' do
|
133
130
|
channel = 1
|
@@ -138,27 +135,27 @@ module AMQ
|
|
138
135
|
expect(method_frame.channel).to eq(1)
|
139
136
|
end
|
140
137
|
end
|
141
|
-
|
138
|
+
|
142
139
|
describe '.decode' do
|
143
140
|
subject do
|
144
|
-
CancelOk.decode("\x03foo\x01")
|
141
|
+
CancelOk.decode("\x03foo\x01")
|
145
142
|
end
|
146
143
|
|
147
144
|
its(:consumer_tag) { should eq('foo') }
|
148
145
|
end
|
149
146
|
end
|
150
147
|
|
151
|
-
describe CancelOk do
|
148
|
+
RSpec.describe CancelOk do
|
152
149
|
describe '.decode' do
|
153
150
|
subject do
|
154
151
|
CancelOk.decode("\x03foo")
|
155
152
|
end
|
156
|
-
|
153
|
+
|
157
154
|
its(:consumer_tag) { should eq('foo') }
|
158
155
|
end
|
159
156
|
end
|
160
157
|
|
161
|
-
describe Publish do
|
158
|
+
RSpec.describe Publish do
|
162
159
|
describe '.encode' do
|
163
160
|
it 'encodes the parameters into a list of MethodFrames' do
|
164
161
|
channel = 1
|
@@ -181,12 +178,12 @@ module AMQ
|
|
181
178
|
end
|
182
179
|
end
|
183
180
|
|
184
|
-
describe Return do
|
181
|
+
RSpec.describe Return do
|
185
182
|
describe '.decode' do
|
186
183
|
subject do
|
187
184
|
Return.decode("\x019\fNO_CONSUMERS\namq.fanout\x00")
|
188
185
|
end
|
189
|
-
|
186
|
+
|
190
187
|
its(:reply_code) { should eq(313) }
|
191
188
|
its(:reply_text) { should eq('NO_CONSUMERS') }
|
192
189
|
its(:exchange) { should eq('amq.fanout') }
|
@@ -194,12 +191,12 @@ module AMQ
|
|
194
191
|
end
|
195
192
|
end
|
196
193
|
|
197
|
-
describe Deliver do
|
194
|
+
RSpec.describe Deliver do
|
198
195
|
describe '.decode' do
|
199
196
|
subject do
|
200
197
|
Deliver.decode("\e-1300560114000-445586772970\x00\x00\x00\x00\x00\x00\x00c\x00\namq.fanout\x00")
|
201
198
|
end
|
202
|
-
|
199
|
+
|
203
200
|
its(:consumer_tag) { should eq('-1300560114000-445586772970') }
|
204
201
|
its(:delivery_tag) { should eq(99) }
|
205
202
|
its(:redelivered) { should eq(false) }
|
@@ -207,8 +204,8 @@ module AMQ
|
|
207
204
|
its(:routing_key) { should eq('') }
|
208
205
|
end
|
209
206
|
end
|
210
|
-
|
211
|
-
describe Get do
|
207
|
+
|
208
|
+
RSpec.describe Get do
|
212
209
|
describe '.encode' do
|
213
210
|
it 'encodes the parameters into a MethodFrame' do
|
214
211
|
channel = 1
|
@@ -220,13 +217,13 @@ module AMQ
|
|
220
217
|
end
|
221
218
|
end
|
222
219
|
end
|
223
|
-
|
224
|
-
describe GetOk do
|
220
|
+
|
221
|
+
RSpec.describe GetOk do
|
225
222
|
describe '.decode' do
|
226
223
|
subject do
|
227
224
|
GetOk.decode("\x00\x00\x00\x00\x00\x00\x00\x06\x00\namq.fanout\x00\x00\x00\x00^")
|
228
225
|
end
|
229
|
-
|
226
|
+
|
230
227
|
its(:delivery_tag) { should eq(6) }
|
231
228
|
its(:redelivered) { should eq(false) }
|
232
229
|
its(:exchange) { should eq('amq.fanout') }
|
@@ -234,18 +231,18 @@ module AMQ
|
|
234
231
|
its(:message_count) { should eq(94) }
|
235
232
|
end
|
236
233
|
end
|
237
|
-
|
238
|
-
describe GetEmpty do
|
234
|
+
|
235
|
+
RSpec.describe GetEmpty do
|
239
236
|
describe '.decode' do
|
240
237
|
subject do
|
241
238
|
GetEmpty.decode("\x03foo")
|
242
239
|
end
|
243
|
-
|
240
|
+
|
244
241
|
its(:cluster_id) { should eq('foo') }
|
245
242
|
end
|
246
243
|
end
|
247
244
|
|
248
|
-
describe Ack do
|
245
|
+
RSpec.describe Ack do
|
249
246
|
describe '.encode' do
|
250
247
|
it 'encodes the parameters into a MethodFrame' do
|
251
248
|
channel = 1
|
@@ -257,8 +254,8 @@ module AMQ
|
|
257
254
|
end
|
258
255
|
end
|
259
256
|
end
|
260
|
-
|
261
|
-
describe Reject do
|
257
|
+
|
258
|
+
RSpec.describe Reject do
|
262
259
|
describe '.encode' do
|
263
260
|
it 'encodes the parameters into a MethodFrame' do
|
264
261
|
channel = 1
|
@@ -270,8 +267,8 @@ module AMQ
|
|
270
267
|
end
|
271
268
|
end
|
272
269
|
end
|
273
|
-
|
274
|
-
describe RecoverAsync do
|
270
|
+
|
271
|
+
RSpec.describe RecoverAsync do
|
275
272
|
describe '.encode' do
|
276
273
|
it 'encodes the parameters into a MethodFrame' do
|
277
274
|
channel = 1
|
@@ -282,8 +279,8 @@ module AMQ
|
|
282
279
|
end
|
283
280
|
end
|
284
281
|
end
|
285
|
-
|
286
|
-
describe Recover do
|
282
|
+
|
283
|
+
RSpec.describe Recover do
|
287
284
|
describe '.encode' do
|
288
285
|
it 'encodes the parameters into a MethodFrame' do
|
289
286
|
channel = 1
|
@@ -295,22 +292,22 @@ module AMQ
|
|
295
292
|
end
|
296
293
|
end
|
297
294
|
|
298
|
-
# describe RecoverOk do
|
295
|
+
# RSpec.describe RecoverOk do
|
299
296
|
# describe '.decode' do
|
300
297
|
# end
|
301
298
|
# end
|
302
|
-
|
303
|
-
describe Nack do
|
299
|
+
|
300
|
+
RSpec.describe Nack do
|
304
301
|
describe '.decode' do
|
305
302
|
subject do
|
306
303
|
Nack.decode("\x00\x00\x00\x00\x00\x00\x00\x09\x03")
|
307
304
|
end
|
308
|
-
|
305
|
+
|
309
306
|
its(:delivery_tag) { should eq(9) }
|
310
307
|
its(:multiple) { should eq(true) }
|
311
308
|
its(:requeue) { should eq(true) }
|
312
309
|
end
|
313
|
-
|
310
|
+
|
314
311
|
describe '.encode' do
|
315
312
|
it 'encodes the parameters into a MethodFrame' do
|
316
313
|
channel = 1
|