amqp 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -0
- data/amqp.gemspec +1 -1
- data/examples/error_handling/hello_world_producer.rb +1 -1
- data/examples/patterns/request_reply/client.rb +1 -2
- data/examples/patterns/request_reply/server.rb +0 -1
- data/examples/publishing/returned_messages.rb +1 -1
- data/lib/amqp/exceptions.rb +10 -1
- data/lib/amqp/version.rb +1 -1
- data/spec/integration/basic_return_spec.rb +3 -3
- data/spec/integration/channel_level_exception_with_multiple_channels_spec.rb +0 -1
- data/spec/integration/extensions/rabbitmq/publisher_confirmations_spec.rb +1 -1
- data/spec/integration/multiple_consumers_per_queue_spec.rb +5 -65
- data/spec/integration/regressions/concurrent_publishing_on_the_same_channel_spec.rb +1 -1
- data/spec/integration/reply_queue_communication_spec.rb +1 -2
- metadata +7 -8
- data/spec/integration/immediate_messages_spec.rb +0 -59
data/.travis.yml
CHANGED
data/amqp.gemspec
CHANGED
@@ -39,7 +39,7 @@ AMQP.start(:host => ENV.fetch("BROKER_HOST", "localhost")) do |connection, open_
|
|
39
39
|
EventMachine.add_periodic_timer(0.8) do
|
40
40
|
puts "Publishing via amq.fanout..."
|
41
41
|
# messages must be routable & there must be at least one consumer.
|
42
|
-
exchange.publish("Routed via amq.fanout", :
|
42
|
+
exchange.publish("Routed via amq.fanout", :mandatory => true)
|
43
43
|
end
|
44
44
|
|
45
45
|
|
@@ -19,8 +19,7 @@ EventMachine.run do
|
|
19
19
|
channel.default_exchange.publish("get.time",
|
20
20
|
:routing_key => "amqpgem.examples.services.time",
|
21
21
|
:message_id => Kernel.rand(10101010).to_s,
|
22
|
-
:reply_to => replies_queue.name
|
23
|
-
:immediate => true)
|
22
|
+
:reply_to => replies_queue.name)
|
24
23
|
end
|
25
24
|
|
26
25
|
|
data/lib/amqp/exceptions.rb
CHANGED
@@ -43,8 +43,17 @@ module AMQP
|
|
43
43
|
def initialize(settings)
|
44
44
|
@settings = settings
|
45
45
|
|
46
|
-
super("AMQP broker closed TCP connection before authentication succeeded: this usually means authentication failure due to misconfiguration. Settings are #{
|
46
|
+
super("AMQP broker closed TCP connection before authentication succeeded: this usually means authentication failure due to misconfiguration. Settings are #{filtered_settings.inspect}")
|
47
47
|
end # initialize(settings)
|
48
|
+
|
49
|
+
def filtered_settings
|
50
|
+
filtered_settings = settings.dup
|
51
|
+
[:pass, :password].each do |sensitve_setting|
|
52
|
+
filtered_settings[sensitve_setting] &&= '[filtered]'
|
53
|
+
end
|
54
|
+
|
55
|
+
filtered_settings
|
56
|
+
end
|
48
57
|
end # PossibleAuthenticationFailureError
|
49
58
|
|
50
59
|
|
data/lib/amqp/version.rb
CHANGED
@@ -38,11 +38,11 @@ describe "Message published as mandatory" do
|
|
38
38
|
@exchange.on_return do |basic_return, header, body|
|
39
39
|
returned_messages << basic_return.reply_text
|
40
40
|
end
|
41
|
-
(1..10).to_a.each { |m| @exchange.publish(m, :
|
41
|
+
(1..10).to_a.each { |m| @exchange.publish(m, :mandatory => true) }
|
42
42
|
|
43
43
|
done(1.0) {
|
44
|
-
returned_messages.should == Array.new(10) { "
|
44
|
+
returned_messages.should == Array.new(10) { "NO_ROUTE" }
|
45
45
|
}
|
46
46
|
end
|
47
47
|
end
|
48
|
-
end
|
48
|
+
end
|
@@ -58,7 +58,7 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
58
58
|
|
59
59
|
EventMachine.add_timer(1.0) do
|
60
60
|
messages.each do |message|
|
61
|
-
exchange.publish(message, :
|
61
|
+
exchange.publish(message, :mandatory => true, :routing_key => queue.name)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -104,7 +104,7 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
104
104
|
|
105
105
|
EventMachine.add_timer(1.0) do
|
106
106
|
messages.each do |message|
|
107
|
-
exchange.publish(message, :
|
107
|
+
exchange.publish(message, :mandatory => true, :routing_key => queue.name)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -150,7 +150,7 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
150
150
|
|
151
151
|
EventMachine.add_timer(1.0) do
|
152
152
|
messages.each do |message|
|
153
|
-
exchange.publish(message, :
|
153
|
+
exchange.publish(message, :mandatory => true, :routing_key => queue.name)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -199,7 +199,7 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
199
199
|
|
200
200
|
EventMachine.add_timer(1.0) do
|
201
201
|
messages.each do |message|
|
202
|
-
exchange.publish(message, :
|
202
|
+
exchange.publish(message, :mandatory => true, :routing_key => queue.name)
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -245,7 +245,7 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
245
245
|
|
246
246
|
EventMachine.add_timer(1.0) do
|
247
247
|
messages.each do |message|
|
248
|
-
exchange.publish(message, :
|
248
|
+
exchange.publish(message, :mandatory => true, :routing_key => queue.name)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
@@ -256,64 +256,4 @@ describe "Multiple non-exclusive consumers per queue" do
|
|
256
256
|
}
|
257
257
|
end # it
|
258
258
|
end # context
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
context "with equal prefetch levels and ALL consumers cancelled mid-flight" do
|
263
|
-
it "returns all immediate messages" do
|
264
|
-
@returned_messages = []
|
265
|
-
|
266
|
-
channel = AMQP::Channel.new
|
267
|
-
channel.on_error do |ch, channel_close|
|
268
|
-
raise(channel_close.reply_text)
|
269
|
-
end
|
270
|
-
|
271
|
-
queue = channel.queue("amqpgem.integration.roundrobin.queue1", :auto_delete => true) do
|
272
|
-
consumer1 = AMQP::Consumer.new(channel, queue)
|
273
|
-
consumer2 = AMQP::Consumer.new(channel, queue, "#{queue.name}-consumer-#{rand}-#{Time.now}", false, true)
|
274
|
-
|
275
|
-
consumer1.consume.on_delivery do |basic_deliver, metadata, payload|
|
276
|
-
@consumer1_mailbox << payload
|
277
|
-
end
|
278
|
-
|
279
|
-
consumer2.consume(true).on_delivery do |metadata, payload|
|
280
|
-
@consumer2_mailbox << payload
|
281
|
-
end
|
282
|
-
|
283
|
-
queue.subscribe do |metadata, payload|
|
284
|
-
@consumer3_mailbox << payload
|
285
|
-
end
|
286
|
-
queue.should be_subscribed
|
287
|
-
queue.unsubscribe
|
288
|
-
queue.should_not be_subscribed
|
289
|
-
|
290
|
-
consumer2.should be_subscribed
|
291
|
-
consumer2.callback.should_not be_nil
|
292
|
-
consumer2.cancel
|
293
|
-
consumer2.should_not be_subscribed
|
294
|
-
consumer2.callback.should be_nil
|
295
|
-
|
296
|
-
consumer1.should be_subscribed
|
297
|
-
consumer1.callback.should_not be_nil
|
298
|
-
consumer1.cancel
|
299
|
-
consumer1.should_not be_subscribed
|
300
|
-
consumer1.callback.should be_nil
|
301
|
-
end
|
302
|
-
|
303
|
-
exchange = channel.default_exchange
|
304
|
-
exchange.on_return do |basic_return, metadata, payload|
|
305
|
-
@returned_messages << payload
|
306
|
-
end
|
307
|
-
|
308
|
-
EventMachine.add_timer(1.0) do
|
309
|
-
messages.each do |message|
|
310
|
-
exchange.publish(message, :immediate => true, :mandatory => true, :routing_key => queue.name)
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
done(6.0) {
|
315
|
-
@returned_messages.size.should == 100
|
316
|
-
}
|
317
|
-
end # it
|
318
|
-
end # context
|
319
259
|
end # describe
|
@@ -73,7 +73,7 @@ if mri?
|
|
73
73
|
20.times do
|
74
74
|
Thread.new do
|
75
75
|
messages.each do |message|
|
76
|
-
exchange.publish(message, :routing_key => queue.name, :
|
76
|
+
exchange.publish(message, :routing_key => queue.name, :mandatory => true)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 43
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 8
|
10
|
+
version: 0.9.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aman Gupta
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-10-11 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: eventmachine
|
@@ -41,12 +41,12 @@ dependencies:
|
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 49
|
45
45
|
segments:
|
46
46
|
- 0
|
47
47
|
- 9
|
48
|
-
-
|
49
|
-
version: 0.9.
|
48
|
+
- 5
|
49
|
+
version: 0.9.5
|
50
50
|
type: :runtime
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
@@ -306,7 +306,6 @@ files:
|
|
306
306
|
- spec/integration/fanout_exchange_routing_spec.rb
|
307
307
|
- spec/integration/headers_exchange_routing_spec.rb
|
308
308
|
- spec/integration/hello_world_spec.rb
|
309
|
-
- spec/integration/immediate_messages_spec.rb
|
310
309
|
- spec/integration/mandatory_messages_spec.rb
|
311
310
|
- spec/integration/message_acknowledgement_spec.rb
|
312
311
|
- spec/integration/message_metadata_access_spec.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
|
5
|
-
describe "When queue has no consumers" do
|
6
|
-
|
7
|
-
#
|
8
|
-
# Environment
|
9
|
-
#
|
10
|
-
|
11
|
-
include EventedSpec::AMQPSpec
|
12
|
-
default_timeout 1.5
|
13
|
-
|
14
|
-
amqp_before do
|
15
|
-
@producer_channel = AMQP::Channel.new
|
16
|
-
@consumer_channel = AMQP::Channel.new
|
17
|
-
end
|
18
|
-
|
19
|
-
# ...
|
20
|
-
|
21
|
-
|
22
|
-
#
|
23
|
-
# Examples
|
24
|
-
#
|
25
|
-
|
26
|
-
context "and message is published as :immediate" do
|
27
|
-
it "that message is returned to the publisher" do
|
28
|
-
exchange = @producer_channel.fanout("amq.fanout")
|
29
|
-
queue = @consumer_channel.queue("", :exclusive => true)
|
30
|
-
|
31
|
-
exchange.on_return do |basic_return, metadata, payload|
|
32
|
-
done if payload == "immediate message body"
|
33
|
-
end
|
34
|
-
|
35
|
-
queue.bind(exchange) do
|
36
|
-
exchange.publish "immediate message body", :immediate => true
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
context "and message is published as non :immediate" do
|
44
|
-
it "that message is dropped" do
|
45
|
-
exchange = @producer_channel.fanout("amq.fanout")
|
46
|
-
queue = @consumer_channel.queue("", :exclusive => true)
|
47
|
-
|
48
|
-
exchange.on_return do |basic_return, metadata, payload|
|
49
|
-
fail "Should not happen"
|
50
|
-
end
|
51
|
-
|
52
|
-
queue.bind(exchange) do
|
53
|
-
exchange.publish "non-immediate message body", :immediate => false
|
54
|
-
end
|
55
|
-
|
56
|
-
done(1.0)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end # describe
|