amq-client 0.7.0.alpha20 → 0.7.0.alpha21
Sign up to get free protection for your applications and to get access to all the features.
- data/amq-client.gemspec +0 -2
- data/lib/amq/client/version.rb +1 -1
- data/spec/integration/coolio/basic_ack_spec.rb +2 -2
- data/spec/integration/coolio/basic_cancel_spec.rb +43 -0
- data/spec/integration/coolio/basic_consume_spec.rb +89 -0
- data/spec/integration/coolio/exchange_declare_spec.rb +0 -1
- data/spec/integration/eventmachine/basic_ack_spec.rb +2 -2
- data/spec/integration/eventmachine/basic_cancel_spec.rb +43 -0
- data/spec/integration/eventmachine/basic_consume_spec.rb +89 -0
- data/spec/integration/eventmachine/exchange_declare_spec.rb +0 -1
- metadata +11 -8
data/amq-client.gemspec
CHANGED
@@ -12,8 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.homepage = "http://github.com/ruby-amqp/amq-client"
|
13
13
|
s.summary = "amq-client is a fully-featured, low-level AMQP 0.9.1 client"
|
14
14
|
s.description = "amq-client supports multiple networking adapters (EventMachine, TCP sockets, cool.io) and supposed to back more opinionated AMQP clients (such as amqp gem, bunny, et cetera) or be used directly in cases when access to more advanced AMQP 0.9.1 features is more important that convenient APIs"
|
15
|
-
s.cert_chain = nil
|
16
|
-
s.has_rdoc = true
|
17
15
|
|
18
16
|
# files
|
19
17
|
s.files = `git ls-files`.split("\n").reject { |file| file =~ /^vendor\// || file =~ /^gemfiles\// }
|
data/lib/amq/client/version.rb
CHANGED
@@ -30,9 +30,9 @@ describe "AMQ::Client::CoolioClient", "Basic.Ack", :nojruby => true do
|
|
30
30
|
end # open
|
31
31
|
|
32
32
|
done(0.8) {
|
33
|
-
@received_messages.
|
33
|
+
@received_messages.should =~ messages
|
34
34
|
}
|
35
35
|
end # coolio_amqp_connect
|
36
36
|
end # it
|
37
37
|
end # context
|
38
|
-
end # describe
|
38
|
+
end # describe
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration/coolio/spec_helper'
|
3
|
+
|
4
|
+
describe "AMQ::Client::CoolioClient", "Basic.Cancel", :nojruby => true do
|
5
|
+
include EventedSpec::SpecHelper
|
6
|
+
default_timeout 4
|
7
|
+
|
8
|
+
let(:messages) { (0..99).map {|i| "Message #{i}" } }
|
9
|
+
|
10
|
+
it "should stop receiving messages after receiving cancel-ok" do
|
11
|
+
@received_messages = []
|
12
|
+
coolio_amqp_connect do |client|
|
13
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
14
|
+
channel.open do
|
15
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
16
|
+
queue.bind("amq.fanout")
|
17
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
18
|
+
|
19
|
+
queue.consume(true) do |amq_method|
|
20
|
+
queue.on_delivery do |method, header, payload|
|
21
|
+
@received_messages << payload
|
22
|
+
end
|
23
|
+
|
24
|
+
messages.each do |message|
|
25
|
+
exchange.publish(message)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
delayed(1.5) {
|
30
|
+
@received_messages.should =~ messages
|
31
|
+
queue.cancel do
|
32
|
+
exchange.publish("Extra message, should not be received")
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
done(2.5) {
|
37
|
+
@received_messages.should =~ messages
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end # it "should stop receiving messages after receiving cancel-ok"
|
43
|
+
end # describe AMQ::Client::CoolioClient, "Basic.Consume"
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration/coolio/spec_helper'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Note that this spec doesn't test acknowledgements.
|
6
|
+
# See basic_ack_spec for example with acks
|
7
|
+
#
|
8
|
+
|
9
|
+
describe "AMQ::Client::CoolioClient", "Basic.Consume", :nojruby => true do
|
10
|
+
include EventedSpec::SpecHelper
|
11
|
+
default_timeout 4
|
12
|
+
|
13
|
+
context "sending 100 messages" do
|
14
|
+
let(:messages) { (0..99).map {|i| "Message #{i}" } }
|
15
|
+
|
16
|
+
it "should receive all the messages" do
|
17
|
+
@received_messages = []
|
18
|
+
coolio_amqp_connect do |client|
|
19
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
20
|
+
channel.open do
|
21
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
22
|
+
queue.bind("amq.fanout")
|
23
|
+
|
24
|
+
queue.consume(true) do |amq_method|
|
25
|
+
queue.on_delivery do |method, header, payload|
|
26
|
+
@received_messages << payload
|
27
|
+
end
|
28
|
+
|
29
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
30
|
+
messages.each do |message|
|
31
|
+
exchange.publish(message)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
done(1.5) {
|
36
|
+
@received_messages.should =~ messages
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end # it "should receive all the messages"
|
41
|
+
|
42
|
+
it "should not leave messages in the queues with noack=true" do
|
43
|
+
@received_messages = []
|
44
|
+
@rereceived_messages = []
|
45
|
+
coolio_amqp_connect do |client|
|
46
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
47
|
+
channel.open do
|
48
|
+
channel.qos(0, 1) # Maximum prefetch size = 1
|
49
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
50
|
+
queue.bind("amq.fanout")
|
51
|
+
|
52
|
+
# Change noack to false and watch spec fail
|
53
|
+
queue.consume(true) do |amq_method|
|
54
|
+
queue.on_delivery do |method, header, payload|
|
55
|
+
@received_messages << payload
|
56
|
+
end
|
57
|
+
|
58
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
59
|
+
messages.each do |message|
|
60
|
+
exchange.publish(message)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# We're opening another channel and starting consuming the same queue,
|
65
|
+
# assuming 1.5 secs was enough to receive all the messages
|
66
|
+
delayed(1.5) do
|
67
|
+
other_channel = AMQ::Client::Channel.new(client, 2)
|
68
|
+
other_channel.open do
|
69
|
+
other_channel.qos(0, 1) # Maximum prefetch size = 1
|
70
|
+
other_queue = AMQ::Client::Queue.new(client, other_channel, queue.name)
|
71
|
+
other_queue.consume(true) do |amq_method|
|
72
|
+
other_queue.on_delivery do |method, header, payload|
|
73
|
+
@rereceived_messages << payload
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
done(2.5) {
|
83
|
+
@rereceived_messages.should == []
|
84
|
+
@received_messages.should =~ messages
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end # it "should not leave messages in the queues with noack=true"
|
88
|
+
end # context "sending 100 messages"
|
89
|
+
end # describe AMQ::Client::CoolioClient, "Basic.Consume"
|
@@ -94,7 +94,6 @@ describe "AMQ::Client::CoolioClient", "Exchange.Declare", :nojruby => true do
|
|
94
94
|
end
|
95
95
|
exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
|
96
96
|
exchange.declare(false, false, false, false) do # initial declaration
|
97
|
-
exchange.delete
|
98
97
|
AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(false) do
|
99
98
|
@callback_fired = true
|
100
99
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration/eventmachine/spec_helper'
|
3
|
+
|
4
|
+
describe AMQ::Client::EventMachineClient, "Basic.Cancel" do
|
5
|
+
include EventedSpec::SpecHelper
|
6
|
+
default_timeout 4
|
7
|
+
|
8
|
+
let(:messages) { (0..99).map {|i| "Message #{i}" } }
|
9
|
+
|
10
|
+
it "should stop receiving messages after receiving cancel-ok" do
|
11
|
+
@received_messages = []
|
12
|
+
em_amqp_connect do |client|
|
13
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
14
|
+
channel.open do
|
15
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
16
|
+
queue.bind("amq.fanout")
|
17
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
18
|
+
|
19
|
+
queue.consume(true) do |amq_method|
|
20
|
+
queue.on_delivery do |method, header, payload|
|
21
|
+
@received_messages << payload
|
22
|
+
end
|
23
|
+
|
24
|
+
messages.each do |message|
|
25
|
+
exchange.publish(message)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
delayed(1.5) {
|
30
|
+
@received_messages.should =~ messages
|
31
|
+
queue.cancel do
|
32
|
+
exchange.publish("Extra message, should not be received")
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
done(2.5) {
|
37
|
+
@received_messages.should =~ messages
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end # it "should stop receiving messages after receiving cancel-ok"
|
43
|
+
end # describe AMQ::Client::EventMachineClient, "Basic.Consume"
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'integration/eventmachine/spec_helper'
|
3
|
+
|
4
|
+
#
|
5
|
+
# Note that this spec doesn't test acknowledgements.
|
6
|
+
# See basic_ack_spec for example with acks
|
7
|
+
#
|
8
|
+
|
9
|
+
describe AMQ::Client::EventMachineClient, "Basic.Consume" do
|
10
|
+
include EventedSpec::SpecHelper
|
11
|
+
default_timeout 4
|
12
|
+
|
13
|
+
context "sending 100 messages" do
|
14
|
+
let(:messages) { (0..99).map {|i| "Message #{i}" } }
|
15
|
+
|
16
|
+
it "should receive all the messages" do
|
17
|
+
@received_messages = []
|
18
|
+
em_amqp_connect do |client|
|
19
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
20
|
+
channel.open do
|
21
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
22
|
+
queue.bind("amq.fanout")
|
23
|
+
|
24
|
+
queue.consume(true) do |amq_method|
|
25
|
+
queue.on_delivery do |method, header, payload|
|
26
|
+
@received_messages << payload
|
27
|
+
end
|
28
|
+
|
29
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
30
|
+
messages.each do |message|
|
31
|
+
exchange.publish(message)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
done(1.5) {
|
36
|
+
@received_messages.should =~ messages
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end # it "should receive all the messages"
|
41
|
+
|
42
|
+
it "should not leave messages in the queues with noack=true" do
|
43
|
+
@received_messages = []
|
44
|
+
@rereceived_messages = []
|
45
|
+
em_amqp_connect do |client|
|
46
|
+
channel = AMQ::Client::Channel.new(client, 1)
|
47
|
+
channel.open do
|
48
|
+
channel.qos(0, 1) # Maximum prefetch size = 1
|
49
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
50
|
+
queue.bind("amq.fanout")
|
51
|
+
|
52
|
+
# Change noack to false and watch spec fail
|
53
|
+
queue.consume(true) do |amq_method|
|
54
|
+
queue.on_delivery do |method, header, payload|
|
55
|
+
@received_messages << payload
|
56
|
+
end
|
57
|
+
|
58
|
+
exchange = AMQ::Client::Exchange.new(client, channel, "amq.fanout", :fanout)
|
59
|
+
messages.each do |message|
|
60
|
+
exchange.publish(message)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# We're opening another channel and starting consuming the same queue,
|
65
|
+
# assuming 1.5 secs was enough to receive all the messages
|
66
|
+
delayed(1.5) do
|
67
|
+
other_channel = AMQ::Client::Channel.new(client, 2)
|
68
|
+
other_channel.open do
|
69
|
+
other_channel.qos(0, 1) # Maximum prefetch size = 1
|
70
|
+
other_queue = AMQ::Client::Queue.new(client, other_channel, queue.name)
|
71
|
+
other_queue.consume(true) do |amq_method|
|
72
|
+
other_queue.on_delivery do |method, header, payload|
|
73
|
+
@rereceived_messages << payload
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
done(2.5) {
|
83
|
+
@rereceived_messages.should == []
|
84
|
+
@received_messages.should =~ messages
|
85
|
+
}
|
86
|
+
end
|
87
|
+
end # it "should not leave messages in the queues with noack=true"
|
88
|
+
end # context "sending 100 messages"
|
89
|
+
end # describe AMQ::Client::EventMachineClient, "Basic.Consume"
|
@@ -94,7 +94,6 @@ describe AMQ::Client::EventMachineClient, "Exchange.Declare" do
|
|
94
94
|
end
|
95
95
|
exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
|
96
96
|
exchange.declare(false, false, false, false) do # initial declaration
|
97
|
-
exchange.delete
|
98
97
|
AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(false) do
|
99
98
|
@callback_fired = true
|
100
99
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -3702664442
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
9
|
- 0
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 0.7.0.
|
11
|
+
- 21
|
12
|
+
version: 0.7.0.alpha21
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Jakub Stastny
|
@@ -18,9 +18,9 @@ authors:
|
|
18
18
|
- Mark Abramov
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
|
-
cert_chain:
|
22
|
-
|
23
|
-
|
21
|
+
cert_chain: []
|
22
|
+
|
23
|
+
date: 2011-05-10 00:00:00 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
@@ -178,6 +178,8 @@ files:
|
|
178
178
|
- spec/client/framing/string_frame_spec.rb
|
179
179
|
- spec/client/protocol/get_response_spec.rb
|
180
180
|
- spec/integration/coolio/basic_ack_spec.rb
|
181
|
+
- spec/integration/coolio/basic_cancel_spec.rb
|
182
|
+
- spec/integration/coolio/basic_consume_spec.rb
|
181
183
|
- spec/integration/coolio/basic_get_spec.rb
|
182
184
|
- spec/integration/coolio/basic_return_spec.rb
|
183
185
|
- spec/integration/coolio/channel_close_spec.rb
|
@@ -189,6 +191,8 @@ files:
|
|
189
191
|
- spec/integration/coolio/tx_commit_spec.rb
|
190
192
|
- spec/integration/coolio/tx_rollback_spec.rb
|
191
193
|
- spec/integration/eventmachine/basic_ack_spec.rb
|
194
|
+
- spec/integration/eventmachine/basic_cancel_spec.rb
|
195
|
+
- spec/integration/eventmachine/basic_consume_spec.rb
|
192
196
|
- spec/integration/eventmachine/basic_get_spec.rb
|
193
197
|
- spec/integration/eventmachine/basic_return_spec.rb
|
194
198
|
- spec/integration/eventmachine/channel_close_spec.rb
|
@@ -218,7 +222,6 @@ files:
|
|
218
222
|
- doc/index.html
|
219
223
|
- doc/method_list.html
|
220
224
|
- doc/top-level-namespace.html
|
221
|
-
has_rdoc: true
|
222
225
|
homepage: http://github.com/ruby-amqp/amq-client
|
223
226
|
licenses: []
|
224
227
|
|
@@ -250,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
253
|
requirements: []
|
251
254
|
|
252
255
|
rubyforge_project: amq-client
|
253
|
-
rubygems_version: 1.
|
256
|
+
rubygems_version: 1.8.1
|
254
257
|
signing_key:
|
255
258
|
specification_version: 3
|
256
259
|
summary: amq-client is a fully-featured, low-level AMQP 0.9.1 client
|