amq-client 0.5.0 → 0.7.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -2
- data/lib/amq/client/version.rb +1 -1
- data/spec/integration/coolio/basic_ack_spec.rb +2 -2
- data/spec/integration/coolio/basic_get_spec.rb +8 -6
- data/spec/integration/coolio/basic_return_spec.rb +4 -0
- data/spec/integration/coolio/channel_flow_spec.rb +10 -14
- data/spec/integration/coolio/tx_rollback_spec.rb +1 -0
- data/spec/integration/eventmachine/basic_ack_spec.rb +1 -3
- data/spec/integration/eventmachine/basic_get_spec.rb +11 -8
- data/spec/integration/eventmachine/basic_return_spec.rb +3 -0
- data/spec/integration/eventmachine/channel_flow_spec.rb +8 -10
- metadata +66 -40
data/Gemfile
CHANGED
@@ -2,11 +2,21 @@
|
|
2
2
|
|
3
3
|
source :rubygems
|
4
4
|
|
5
|
+
# Use local clones if possible.
|
6
|
+
def custom_gem(name, options = Hash.new)
|
7
|
+
local_path = File.expand_path("../../#{name}", __FILE__)
|
8
|
+
if ENV["USE_AMQP_CUSTOM_GEMS"] && File.directory?(local_path)
|
9
|
+
gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }
|
10
|
+
else
|
11
|
+
gem name, options
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
5
15
|
gem "eventmachine", "0.12.10" #, "1.0.0.beta.3"
|
6
16
|
# cool.io uses iobuffer that won't compile on JRuby
|
7
17
|
# (and, probably, Windows)
|
8
18
|
gem "cool.io", :platform => :ruby
|
9
|
-
|
19
|
+
custom_gem "amq-protocol", :git => "git://github.com/ruby-amqp/amq-protocol.git", :branch => "master"
|
10
20
|
|
11
21
|
group :development do
|
12
22
|
gem "yard"
|
@@ -23,5 +33,5 @@ end
|
|
23
33
|
group :test do
|
24
34
|
gem "rspec", ">=2.0.0"
|
25
35
|
gem "autotest"
|
26
|
-
|
36
|
+
custom_gem "evented-spec", :git => "git://github.com/ruby-amqp/evented-spec.git", :branch => "master"
|
27
37
|
end
|
data/lib/amq/client/version.rb
CHANGED
@@ -16,8 +16,8 @@ describe "AMQ::Client::Coolio", "Basic.Ack", :nojruby => true do
|
|
16
16
|
coolio_amqp_connect do |client|
|
17
17
|
channel = AMQ::Client::Channel.new(client, 1)
|
18
18
|
channel.open do
|
19
|
-
queue = AMQ::Client::Queue.new(client, channel)
|
20
|
-
queue.
|
19
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
20
|
+
queue.bind("amq.fanout")
|
21
21
|
|
22
22
|
queue.consume do |_, consumer_tag|
|
23
23
|
queue.on_delivery do |method, header, payload|
|
@@ -34,10 +34,13 @@ describe "AMQ::Client::Coolio", "Basic.Get", :nojruby => true do
|
|
34
34
|
@received_messages << payload
|
35
35
|
end
|
36
36
|
|
37
|
-
|
37
|
+
delayed(0.5) {
|
38
|
+
# need to delete the queue manually because #get doesn't count as consumption,
|
39
|
+
# hence, no auto-delete
|
40
|
+
queue.delete
|
41
|
+
}
|
42
|
+
done(0.75) {
|
38
43
|
@received_messages.should =~ messages
|
39
|
-
|
40
|
-
queue.purge
|
41
44
|
}
|
42
45
|
end
|
43
46
|
end
|
@@ -61,9 +64,8 @@ describe "AMQ::Client::Coolio", "Basic.Get", :nojruby => true do
|
|
61
64
|
header.should be_nil
|
62
65
|
payload.should be_nil
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
+
queue.delete
|
68
|
+
done(0.5)
|
67
69
|
end # get
|
68
70
|
end
|
69
71
|
end # em_amqp_connect
|
@@ -15,6 +15,10 @@ describe "AMQ::Client::Coolio", "Basic.Return", :nojruby => true do
|
|
15
15
|
channel.open do
|
16
16
|
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
17
17
|
|
18
|
+
# need to delete the queue manually because we don't start consumption,
|
19
|
+
# hence, no auto-delete
|
20
|
+
delayed(0.4) { queue.delete }
|
21
|
+
|
18
22
|
exchange = AMQ::Client::Exchange.new(client, channel, "direct-exchange", :direct).declare.on_return do |method|
|
19
23
|
@returned_messages << method.reply_text
|
20
24
|
end
|
@@ -9,16 +9,14 @@ describe "AMQ::Client::Coolio", "Channel.Flow", :nojruby => true do
|
|
9
9
|
coolio_amqp_connect do |client|
|
10
10
|
channel = AMQ::Client::Channel.new(client, 1)
|
11
11
|
channel.open do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
flow_active.should be_true
|
18
|
-
end
|
12
|
+
channel.flow_is_active?.should be_true
|
13
|
+
channel.flow(false) do |_, flow_active|
|
14
|
+
flow_active.should be_false
|
15
|
+
channel.flow(true) do |_, flow_active|
|
16
|
+
flow_active.should be_true
|
19
17
|
end
|
20
|
-
done
|
21
18
|
end
|
19
|
+
done
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -29,16 +27,14 @@ describe "AMQ::Client::Coolio", "Channel.Flow", :nojruby => true do
|
|
29
27
|
channel = AMQ::Client::Channel.new(client, 1)
|
30
28
|
expect {
|
31
29
|
channel.open do
|
32
|
-
|
33
|
-
|
30
|
+
channel.flow_is_active?.should be_true
|
31
|
+
channel.flow(false) do |_, flow_active|
|
32
|
+
flow_active.should be_false
|
34
33
|
channel.flow(false) do |_, flow_active|
|
35
34
|
flow_active.should be_false
|
36
|
-
channel.flow(false) do |_, flow_active|
|
37
|
-
flow_active.should be_false
|
38
|
-
end
|
39
35
|
end
|
40
|
-
done
|
41
36
|
end
|
37
|
+
done
|
42
38
|
end
|
43
39
|
}.to_not raise_error
|
44
40
|
end
|
@@ -16,6 +16,7 @@ describe "AMQ::Client::Coolio", "Tx.Rollback", :nojruby => true do
|
|
16
16
|
|
17
17
|
|
18
18
|
it "should cancel all the changes done during transaction" do
|
19
|
+
pending("Need to figure out details with AMQP protocol on that matter")
|
19
20
|
received_messages = []
|
20
21
|
coolio_amqp_connect do |client|
|
21
22
|
channel = AMQ::Client::Channel.new(client, 1)
|
@@ -13,9 +13,7 @@ describe AMQ::Client::EventMachineClient, "Basic.Ack" do
|
|
13
13
|
em_amqp_connect do |client|
|
14
14
|
channel = AMQ::Client::Channel.new(client, 1)
|
15
15
|
channel.open do
|
16
|
-
queue = AMQ::Client::Queue.new(client, channel)
|
17
|
-
queue.declare
|
18
|
-
|
16
|
+
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
19
17
|
queue.bind("amq.fanout")
|
20
18
|
|
21
19
|
queue.consume do |amq_method|
|
@@ -26,18 +26,22 @@ describe AMQ::Client::EventMachineClient, "Basic.Get" do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
queue.get(true) do |method, header, payload|
|
29
|
-
puts "Got #{payload}"
|
29
|
+
puts "Got #{payload}"
|
30
30
|
@received_messages << payload
|
31
31
|
end
|
32
32
|
queue.get(true) do |method, header, payload|
|
33
|
-
puts "Got #{payload}"
|
33
|
+
puts "Got #{payload}"
|
34
34
|
@received_messages << payload
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
delayed(0.5) {
|
38
|
+
# need to delete the queue manually because #get doesn't count as consumption,
|
39
|
+
# hence, no auto-delete
|
40
|
+
queue.delete
|
41
|
+
}
|
39
42
|
|
40
|
-
|
43
|
+
done(0.75) {
|
44
|
+
@received_messages.should =~ messages
|
41
45
|
}
|
42
46
|
end
|
43
47
|
end
|
@@ -61,9 +65,8 @@ describe AMQ::Client::EventMachineClient, "Basic.Get" do
|
|
61
65
|
header.should be_nil
|
62
66
|
payload.should be_nil
|
63
67
|
|
64
|
-
|
65
|
-
|
66
|
-
}
|
68
|
+
queue.delete
|
69
|
+
done(0.5)
|
67
70
|
end # get
|
68
71
|
end
|
69
72
|
end # em_amqp_connect
|
@@ -14,6 +14,9 @@ describe AMQ::Client::EventMachineClient, "Basic.Return" do
|
|
14
14
|
channel = AMQ::Client::Channel.new(client, 1)
|
15
15
|
channel.open do
|
16
16
|
queue = AMQ::Client::Queue.new(client, channel).declare(false, false, false, true)
|
17
|
+
# need to delete the queue manually because we don't start consumption,
|
18
|
+
# hence, no auto-delete
|
19
|
+
delayed(0.4) { queue.delete }
|
17
20
|
|
18
21
|
exchange = AMQ::Client::Exchange.new(client, channel, "direct-exchange", :direct).declare.on_return do |method|
|
19
22
|
@returned_messages << method.reply_text
|
@@ -11,19 +11,17 @@ describe AMQ::Client::EventMachineClient, "Channel#flow" do
|
|
11
11
|
|
12
12
|
channel = AMQ::Client::Channel.new(client, 1)
|
13
13
|
channel.open do
|
14
|
-
|
15
|
-
channel.flow_is_active?.should be_true
|
14
|
+
channel.flow_is_active?.should be_true
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
channel.flow(false) do |flow_status1|
|
17
|
+
channel.flow_is_active?.should be_false
|
18
|
+
flow_states << channel.flow_is_active?
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end # channel.flow
|
20
|
+
channel.flow(true) do |flow_status2|
|
21
|
+
channel.flow_is_active?.should be_true
|
22
|
+
flow_states << channel.flow_is_active?
|
25
23
|
end # channel.flow
|
26
|
-
end #
|
24
|
+
end # channel.flow
|
27
25
|
end # channel.open
|
28
26
|
|
29
27
|
done(0.5) { flow_states.should == [false, true] }
|
metadata
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1552698946208022685
|
5
|
+
prerelease: 6
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
- alpha
|
11
|
+
- 1
|
12
|
+
version: 0.7.0.alpha1
|
6
13
|
platform: ruby
|
7
|
-
authors:
|
14
|
+
authors:
|
8
15
|
- Jakub Stastny
|
9
16
|
- Michael S. Klishin
|
10
17
|
- Theo Hultberg
|
@@ -12,41 +19,48 @@ authors:
|
|
12
19
|
autorequire:
|
13
20
|
bindir: bin
|
14
21
|
cert_chain:
|
15
|
-
date: 2011-04-17 00:00:00
|
22
|
+
date: 2011-04-17 00:00:00 +04:00
|
16
23
|
default_executable:
|
17
|
-
dependencies:
|
18
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
dependencies:
|
25
|
+
- !ruby/object:Gem::Dependency
|
19
26
|
name: eventmachine
|
20
|
-
|
27
|
+
prerelease: false
|
28
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
29
|
none: false
|
22
|
-
requirements:
|
30
|
+
requirements:
|
23
31
|
- - ~>
|
24
|
-
- !ruby/object:Gem::Version
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
hash: 59
|
34
|
+
segments:
|
35
|
+
- 0
|
36
|
+
- 12
|
37
|
+
- 10
|
25
38
|
version: 0.12.10
|
26
39
|
type: :runtime
|
27
|
-
|
28
|
-
|
29
|
-
- !ruby/object:Gem::Dependency
|
40
|
+
version_requirements: *id001
|
41
|
+
- !ruby/object:Gem::Dependency
|
30
42
|
name: amq-protocol
|
31
|
-
|
43
|
+
prerelease: false
|
44
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
32
45
|
none: false
|
33
|
-
requirements:
|
34
|
-
- -
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
50
|
+
segments:
|
51
|
+
- 0
|
52
|
+
version: "0"
|
37
53
|
type: :runtime
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
TCP sockets, cool.io) and\n supposed to back more opinionated AMQP clients (such
|
42
|
-
as amqp gem, bunny, et cetera) or be used directly\n in cases when access to more
|
43
|
-
advanced AMQP 0.9.1 features is more important that convenient APIs\n"
|
44
|
-
email:
|
54
|
+
version_requirements: *id002
|
55
|
+
description: " amq-client supports multiple networking adapters (EventMachine, TCP sockets, cool.io) and\n supposed to back more opinionated AMQP clients (such as amqp gem, bunny, et cetera) or be used directly\n in cases when access to more advanced AMQP 0.9.1 features is more important that convenient APIs\n"
|
56
|
+
email:
|
45
57
|
- stastny@101ideas.cz
|
46
58
|
- michael@novemberain.com
|
47
59
|
executables: []
|
60
|
+
|
48
61
|
extensions: []
|
49
|
-
|
62
|
+
|
63
|
+
extra_rdoc_files:
|
50
64
|
- README.textile
|
51
65
|
- doc/_index.html
|
52
66
|
- doc/AMQ.html
|
@@ -57,7 +71,7 @@ extra_rdoc_files:
|
|
57
71
|
- doc/index.html
|
58
72
|
- doc/method_list.html
|
59
73
|
- doc/top-level-namespace.html
|
60
|
-
files:
|
74
|
+
files:
|
61
75
|
- .gitignore
|
62
76
|
- .gitmodules
|
63
77
|
- .rspec
|
@@ -177,26 +191,38 @@ files:
|
|
177
191
|
has_rdoc: true
|
178
192
|
homepage: http://github.com/ruby-amqp/amq-client
|
179
193
|
licenses: []
|
194
|
+
|
180
195
|
post_install_message:
|
181
196
|
rdoc_options: []
|
182
|
-
|
197
|
+
|
198
|
+
require_paths:
|
183
199
|
- lib
|
184
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
185
201
|
none: false
|
186
|
-
requirements:
|
187
|
-
- -
|
188
|
-
- !ruby/object:Gem::Version
|
189
|
-
|
190
|
-
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
hash: 3
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
version: "0"
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
210
|
none: false
|
192
|
-
requirements:
|
193
|
-
- -
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
|
211
|
+
requirements:
|
212
|
+
- - ">"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
hash: 25
|
215
|
+
segments:
|
216
|
+
- 1
|
217
|
+
- 3
|
218
|
+
- 1
|
219
|
+
version: 1.3.1
|
196
220
|
requirements: []
|
221
|
+
|
197
222
|
rubyforge_project: amq-client
|
198
|
-
rubygems_version: 1.
|
223
|
+
rubygems_version: 1.5.2
|
199
224
|
signing_key:
|
200
225
|
specification_version: 3
|
201
226
|
summary: amq-client is a fully-featured, low-level AMQP 0.9.1 client
|
202
227
|
test_files: []
|
228
|
+
|