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 CHANGED
@@ -43,3 +43,6 @@ matrix:
43
43
  gemfile: gemfiles/eventmachine-pre
44
44
  - rvm: 1.9.2
45
45
  gemfile: Gemfile
46
+
47
+ services:
48
+ - rabbitmq
data/amqp.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  # Dependencies
25
25
  s.add_dependency "eventmachine"
26
- s.add_dependency "amq-client", "~> 0.9.4"
26
+ s.add_dependency "amq-client", "~> 0.9.5"
27
27
  s.add_dependency "amq-protocol", ">= 0.9.4"
28
28
 
29
29
  begin
@@ -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", :immediate => true, :mandatory => true)
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
 
@@ -14,7 +14,6 @@ EventMachine.run do
14
14
  channel.default_exchange.publish(Time.now.to_s,
15
15
  :routing_key => metadata.reply_to,
16
16
  :correlation_id => metadata.message_id,
17
- :immediate => true,
18
17
  :mandatory => true)
19
18
 
20
19
  metadata.ack
@@ -22,7 +22,7 @@ AMQP.start(:host => '127.0.0.1') do |connection|
22
22
 
23
23
  EventMachine.add_timer(0.3) {
24
24
  10.times do |i|
25
- exchange.publish("Message ##{i}", :immediate => true)
25
+ exchange.publish("Message ##{i}")
26
26
  end
27
27
  }
28
28
 
@@ -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 #{settings.inspect}")
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
@@ -6,5 +6,5 @@ module AMQP
6
6
  #
7
7
  # @see AMQ::Protocol::VERSION
8
8
  # @return [String] AMQP gem version
9
- VERSION = '0.9.7'
9
+ VERSION = '0.9.8'
10
10
  end
@@ -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, :immediate => true) }
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) { "NO_CONSUMERS" }
44
+ returned_messages.should == Array.new(10) { "NO_ROUTE" }
45
45
  }
46
46
  end
47
47
  end
48
- end
48
+ end
@@ -53,7 +53,6 @@ describe AMQP do
53
53
  }
54
54
 
55
55
  delayed(0.3) {
56
- @q1.delete
57
56
  @q2.delete
58
57
  }
59
58
 
@@ -116,7 +116,7 @@ describe "Publisher confirmation(s)" do
116
116
  end
117
117
 
118
118
  EventMachine.add_timer(0.5) do
119
- exchange.publish("Hi", :persistent => false, :immediately => true)
119
+ exchange.publish("Hi", :persistent => false)
120
120
  end
121
121
 
122
122
  done(2.0) do
@@ -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, :immediate => true, :mandatory => true, :routing_key => queue.name)
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, :immediate => true, :mandatory => true, :routing_key => queue.name)
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, :immediate => true, :mandatory => true, :routing_key => queue.name)
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, :immediate => true, :mandatory => true, :routing_key => queue.name)
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, :immediate => true, :mandatory => true, :routing_key => queue.name)
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, :immediate => true, :mandatory => true)
76
+ exchange.publish(message, :routing_key => queue.name, :mandatory => true)
77
77
  end
78
78
  end
79
79
  end
@@ -53,8 +53,7 @@ describe "Exclusive server-named queue" do
53
53
  :reply_to => queue2.name,
54
54
  :app_id => "Client",
55
55
  :timestamp => request_timestamp,
56
- :mandatory => true,
57
- :immediate => true)
56
+ :mandatory => true)
58
57
 
59
58
  done(0.2) {
60
59
  queue1.unsubscribe
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: 53
4
+ hash: 43
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 7
10
- version: 0.9.7
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-07-03 00:00:00 Z
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: 51
44
+ hash: 49
45
45
  segments:
46
46
  - 0
47
47
  - 9
48
- - 4
49
- version: 0.9.4
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