amq-client 0.7.0.alpha15 → 0.7.0.alpha16

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,7 +63,7 @@ module AMQ
63
63
 
64
64
 
65
65
 
66
- def declare(passive = false, durable = false, exclusive = false, auto_delete = false, nowait = false, arguments = nil, &block)
66
+ def declare(passive = false, durable = false, auto_delete = false, nowait = false, arguments = nil, &block)
67
67
  @client.send(Protocol::Exchange::Declare.encode(@channel.id, @name, @type.to_s, passive, durable, auto_delete, false, nowait, arguments))
68
68
 
69
69
  unless nowait
@@ -238,7 +238,7 @@ module AMQ
238
238
  # @api public
239
239
  # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.5.)
240
240
  def cancel(nowait = false, &block)
241
- raise "This instance isn't being consumed!" if @consumer_tag.nil?
241
+ raise "There is no consumer tag for this queue. This usually means that you are trying to unsubscribe a queue that never was subscribed for messages in the first place." if @consumer_tag.nil?
242
242
 
243
243
  @client.send(Protocol::Basic::Cancel.encode(@channel.id, @consumer_tag, nowait))
244
244
  @consumer_tag = nil
@@ -1,5 +1,5 @@
1
1
  module AMQ
2
2
  module Client
3
- VERSION = "0.7.0.alpha15"
3
+ VERSION = "0.7.0.alpha16"
4
4
  end
5
5
  end
@@ -0,0 +1,116 @@
1
+ require 'spec_helper'
2
+ require 'integration/coolio/spec_helper'
3
+
4
+ describe "AMQ::Client::CoolioClient", "Exchange.Declare", :nojruby => true do
5
+ include EventedSpec::SpecHelper
6
+ default_timeout 1
7
+ let(:exchange_name) { "amq-client.testexchange.#{Time.now.to_i}" }
8
+ it "should create an exchange and trigger a callback" do
9
+ coolio_amqp_connect do |client|
10
+ channel = AMQ::Client::Channel.new(client, 1)
11
+ channel.open do
12
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
13
+ exchange.declare do
14
+ exchange.delete
15
+ done(0.2)
16
+ end
17
+ end
18
+ end
19
+ end # it "should create an exchange and trigger a callback"
20
+
21
+ context "options" do
22
+ context "passive" do
23
+ context "when set" do
24
+ it "should trigger channel level error if given exchange doesn't exist" do
25
+ coolio_amqp_connect do |client|
26
+ channel = AMQ::Client::Channel.new(client, 1)
27
+ channel.open do
28
+ channel.on_error do
29
+ @error_fired = true
30
+ end
31
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
32
+ exchange.declare(true, false, false, false) do
33
+ @callback_fired = true
34
+ end
35
+ delayed(0.1) { exchange.delete }
36
+ done(0.3)
37
+ end
38
+ end
39
+
40
+ @callback_fired.should be_false
41
+ @error_fired.should be_true
42
+ end # it "should trigger channel level error if given exchange doesn't exist"
43
+
44
+ it "should raise no error and fire the callback if given exchange exists" do
45
+ coolio_amqp_connect do |client|
46
+ channel = AMQ::Client::Channel.new(client, 1)
47
+ channel.open do
48
+ channel.on_error do
49
+ @error_fired = true
50
+ end
51
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
52
+ exchange.declare(false, false, false, false) do # initial declaration
53
+ AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(true) do
54
+ @callback_fired = true
55
+ end
56
+ end
57
+ delayed(0.1) { exchange.delete }
58
+ done(0.3)
59
+ end
60
+ end
61
+
62
+ @callback_fired.should be_true
63
+ @error_fired.should be_false
64
+ end # it "should raise no error and fire the callback if given exchange exists"
65
+ end # context "when set"
66
+
67
+ context "when unset" do
68
+ it "should raise no error and fire the callback if given exchange doesn't exist" do
69
+ coolio_amqp_connect do |client|
70
+ channel = AMQ::Client::Channel.new(client, 1)
71
+ channel.open do
72
+ channel.on_error do
73
+ @error_fired = true
74
+ end
75
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
76
+ exchange.declare(false, false, false, false) do
77
+ @callback_fired = true
78
+ end
79
+ delayed(0.1) { exchange.delete }
80
+ done(0.3)
81
+ end
82
+ end
83
+
84
+ @callback_fired.should be_true
85
+ @error_fired.should be_false
86
+ end # it "should raise no error and fire the callback if given exchange doesn't exist"
87
+
88
+ it "should raise no error and fire the callback if given exchange exists" do
89
+ coolio_amqp_connect do |client|
90
+ channel = AMQ::Client::Channel.new(client, 1)
91
+ channel.open do
92
+ channel.on_error do
93
+ @error_fired = true
94
+ end
95
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
96
+ exchange.declare(false, false, false, false) do # initial declaration
97
+ exchange.delete
98
+ AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(false) do
99
+ @callback_fired = true
100
+ end
101
+ end
102
+ delayed(0.1) { exchange.delete }
103
+ done(0.3)
104
+ end
105
+ end
106
+
107
+ @callback_fired.should be_true
108
+ @error_fired.should be_false
109
+ end # it "should raise no error and fire the callback if given exchange exists"
110
+ end # context "when unset"
111
+ end # context "passive"
112
+
113
+ # Other options make little sense to test
114
+
115
+ end # context "options"
116
+ end # describe
@@ -0,0 +1,116 @@
1
+ require 'spec_helper'
2
+ require 'integration/eventmachine/spec_helper'
3
+
4
+ describe AMQ::Client::EventMachineClient, "Exchange.Declare" do
5
+ include EventedSpec::SpecHelper
6
+ default_timeout 1
7
+ let(:exchange_name) { "amq-client.testexchange.#{Time.now.to_i}" }
8
+ it "should create an exchange and trigger a callback" do
9
+ em_amqp_connect do |client|
10
+ channel = AMQ::Client::Channel.new(client, 1)
11
+ channel.open do
12
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
13
+ exchange.declare do
14
+ exchange.delete
15
+ done(0.2)
16
+ end
17
+ end
18
+ end
19
+ end # it "should create an exchange and trigger a callback"
20
+
21
+ context "options" do
22
+ context "passive" do
23
+ context "when set" do
24
+ it "should trigger channel level error if given exchange doesn't exist" do
25
+ em_amqp_connect do |client|
26
+ channel = AMQ::Client::Channel.new(client, 1)
27
+ channel.open do
28
+ channel.on_error do
29
+ @error_fired = true
30
+ end
31
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
32
+ exchange.declare(true, false, false, false) do
33
+ @callback_fired = true
34
+ end
35
+ delayed(0.1) { exchange.delete }
36
+ done(0.3)
37
+ end
38
+ end
39
+
40
+ @callback_fired.should be_false
41
+ @error_fired.should be_true
42
+ end # it "should trigger channel level error if given exchange doesn't exist"
43
+
44
+ it "should raise no error and fire the callback if given exchange exists" do
45
+ em_amqp_connect do |client|
46
+ channel = AMQ::Client::Channel.new(client, 1)
47
+ channel.open do
48
+ channel.on_error do
49
+ @error_fired = true
50
+ end
51
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
52
+ exchange.declare(false, false, false, false) do # initial declaration
53
+ AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(true) do
54
+ @callback_fired = true
55
+ end
56
+ end
57
+ delayed(0.1) { exchange.delete }
58
+ done(0.3)
59
+ end
60
+ end
61
+
62
+ @callback_fired.should be_true
63
+ @error_fired.should be_false
64
+ end # it "should raise no error and fire the callback if given exchange exists"
65
+ end # context "when set"
66
+
67
+ context "when unset" do
68
+ it "should raise no error and fire the callback if given exchange doesn't exist" do
69
+ em_amqp_connect do |client|
70
+ channel = AMQ::Client::Channel.new(client, 1)
71
+ channel.open do
72
+ channel.on_error do
73
+ @error_fired = true
74
+ end
75
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
76
+ exchange.declare(false, false, false, false) do
77
+ @callback_fired = true
78
+ end
79
+ delayed(0.1) { exchange.delete }
80
+ done(0.3)
81
+ end
82
+ end
83
+
84
+ @callback_fired.should be_true
85
+ @error_fired.should be_false
86
+ end # it "should raise no error and fire the callback if given exchange doesn't exist"
87
+
88
+ it "should raise no error and fire the callback if given exchange exists" do
89
+ em_amqp_connect do |client|
90
+ channel = AMQ::Client::Channel.new(client, 1)
91
+ channel.open do
92
+ channel.on_error do
93
+ @error_fired = true
94
+ end
95
+ exchange = AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout)
96
+ exchange.declare(false, false, false, false) do # initial declaration
97
+ exchange.delete
98
+ AMQ::Client::Exchange.new(client, channel, exchange_name, :fanout).declare(false) do
99
+ @callback_fired = true
100
+ end
101
+ end
102
+ delayed(0.1) { exchange.delete }
103
+ done(0.3)
104
+ end
105
+ end
106
+
107
+ @callback_fired.should be_true
108
+ @error_fired.should be_false
109
+ end # it "should raise no error and fire the callback if given exchange exists"
110
+ end # context "when unset"
111
+ end # context "passive"
112
+
113
+ # Other options make little sense to test
114
+
115
+ end # context "options"
116
+ end # describe
metadata CHANGED
@@ -1,16 +1,10 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: amq-client
3
- version: !ruby/object:Gem::Version
4
- hash: 1369027945
5
- prerelease: true
6
- segments:
7
- - 0
8
- - 7
9
- - 0
10
- - alpha15
11
- version: 0.7.0.alpha15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0.alpha16
5
+ prerelease: 6
12
6
  platform: ruby
13
- authors:
7
+ authors:
14
8
  - Jakub Stastny
15
9
  - Michael S. Klishin
16
10
  - Theo Hultberg
@@ -18,46 +12,41 @@ authors:
18
12
  autorequire:
19
13
  bindir: bin
20
14
  cert_chain:
21
- date: 2011-04-30 00:00:00 +04:00
15
+ date: 2011-05-02 00:00:00.000000000 +04:00
22
16
  default_executable:
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
25
19
  name: eventmachine
26
- prerelease: false
27
- requirement: &id001 !ruby/object:Gem::Requirement
20
+ requirement: &2160740620 !ruby/object:Gem::Requirement
28
21
  none: false
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- hash: 3
33
- segments:
34
- - 0
35
- version: "0"
22
+ requirements:
23
+ - - ! '>='
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
36
26
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: amq-protocol
40
27
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ version_requirements: *2160740620
29
+ - !ruby/object:Gem::Dependency
30
+ name: amq-protocol
31
+ requirement: &2160740160 !ruby/object:Gem::Requirement
42
32
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
50
37
  type: :runtime
51
- version_requirements: *id002
52
- 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
53
- email:
38
+ prerelease: false
39
+ version_requirements: *2160740160
40
+ description: amq-client supports multiple networking adapters (EventMachine, TCP sockets,
41
+ cool.io) and supposed to back more opinionated AMQP clients (such as amqp gem, bunny,
42
+ et cetera) or be used directly in cases when access to more advanced AMQP 0.9.1
43
+ features is more important that convenient APIs
44
+ email:
54
45
  - stastny@101ideas.cz
55
46
  - michael@novemberain.com
56
47
  executables: []
57
-
58
48
  extensions: []
59
-
60
- extra_rdoc_files:
49
+ extra_rdoc_files:
61
50
  - README.textile
62
51
  - doc/_index.html
63
52
  - doc/AMQ.html
@@ -68,7 +57,7 @@ extra_rdoc_files:
68
57
  - doc/index.html
69
58
  - doc/method_list.html
70
59
  - doc/top-level-namespace.html
71
- files:
60
+ files:
72
61
  - .gitignore
73
62
  - .gitmodules
74
63
  - .rspec
@@ -183,6 +172,7 @@ files:
183
172
  - spec/integration/coolio/channel_flow_spec.rb
184
173
  - spec/integration/coolio/connection_close_spec.rb
185
174
  - spec/integration/coolio/connection_start_spec.rb
175
+ - spec/integration/coolio/exchange_declare_spec.rb
186
176
  - spec/integration/coolio/spec_helper.rb
187
177
  - spec/integration/coolio/tx_commit_spec.rb
188
178
  - spec/integration/coolio/tx_rollback_spec.rb
@@ -193,6 +183,7 @@ files:
193
183
  - spec/integration/eventmachine/channel_flow_spec.rb
194
184
  - spec/integration/eventmachine/connection_close_spec.rb
195
185
  - spec/integration/eventmachine/connection_start_spec.rb
186
+ - spec/integration/eventmachine/exchange_declare_spec.rb
196
187
  - spec/integration/eventmachine/spec_helper.rb
197
188
  - spec/integration/eventmachine/tx_commit_spec.rb
198
189
  - spec/integration/eventmachine/tx_rollback_spec.rb
@@ -217,38 +208,26 @@ files:
217
208
  has_rdoc: true
218
209
  homepage: http://github.com/ruby-amqp/amq-client
219
210
  licenses: []
220
-
221
211
  post_install_message:
222
212
  rdoc_options: []
223
-
224
- require_paths:
213
+ require_paths:
225
214
  - lib
226
- required_ruby_version: !ruby/object:Gem::Requirement
215
+ required_ruby_version: !ruby/object:Gem::Requirement
227
216
  none: false
228
- requirements:
229
- - - ">="
230
- - !ruby/object:Gem::Version
231
- hash: 3
232
- segments:
233
- - 0
234
- version: "0"
235
- required_rubygems_version: !ruby/object:Gem::Requirement
217
+ requirements:
218
+ - - ! '>='
219
+ - !ruby/object:Gem::Version
220
+ version: '0'
221
+ required_rubygems_version: !ruby/object:Gem::Requirement
236
222
  none: false
237
- requirements:
238
- - - ">"
239
- - !ruby/object:Gem::Version
240
- hash: 25
241
- segments:
242
- - 1
243
- - 3
244
- - 1
223
+ requirements:
224
+ - - ! '>'
225
+ - !ruby/object:Gem::Version
245
226
  version: 1.3.1
246
227
  requirements: []
247
-
248
228
  rubyforge_project: amq-client
249
- rubygems_version: 1.3.7
229
+ rubygems_version: 1.6.2
250
230
  signing_key:
251
231
  specification_version: 3
252
232
  summary: amq-client is a fully-featured, low-level AMQP 0.9.1 client
253
233
  test_files: []
254
-