bunny 0.9.0.rc2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23f16e1a514fe184d1460364e3a04247ddedf75d
4
- data.tar.gz: a9e0dbba16677d8671a2e20ead8a0b5aa120b9ac
3
+ metadata.gz: a6609fd8d343c1eec98e9da88ae45dfd5f4a8700
4
+ data.tar.gz: 44d923b952630e72f34c86f1301518b2c0f09dde
5
5
  SHA512:
6
- metadata.gz: ede8a080ddae75c6011790a72fa0cb1d21e13e227cba2e4ab3fc35fc5e8b99649601595061ae4f178b3c965487f91ba75944a22fdf86bc51d144e2cf61ca8839
7
- data.tar.gz: 7988d768033079976e984ec930684d195df9ee7dd54e83520149134eed080cec31cbecf83ed4f906e1bcdfbc14b7b90d22445cd0a697826d8b031fe3200d560c
6
+ metadata.gz: 631b259c7c43c8718fc488f4d66324dea03adcce07677454283c2cb23158ca568f87e547e21e2002ff983827f5e6d65c90547a798e4c56ed6e6641e01cff3931
7
+ data.tar.gz: c2aaf955089270d06e50279b6ca1499afdf386767e6fb4f227e3b4ee60471fdc766b1f4e58a68188d0f2670491a9dbc109d9f86a712abc370208c3ab3ebe09ff
@@ -4,12 +4,11 @@ script: "bundle exec rspec -c spec"
4
4
  rvm:
5
5
  - "2.0"
6
6
  - "1.9.3"
7
- - rbx-19mode
8
- - jruby-19mode
7
+ - "rbx-19mode"
8
+ - "jruby-19mode"
9
9
  - "1.9.2"
10
- - "1.8.7"
11
10
  notifications:
12
- email: michael@defprotocol.org
11
+ email: michael@rabbitmq.com
13
12
  services:
14
13
  - rabbitmq
15
14
  branches:
data/Gemfile CHANGED
@@ -29,6 +29,8 @@ group :development do
29
29
 
30
30
  gem "redcarpet", :platform => :mri
31
31
  gem "ruby-prof", :platform => :mri
32
+
33
+ gem "json"
32
34
  end
33
35
 
34
36
  group :test do
data/README.md CHANGED
@@ -83,12 +83,12 @@ To install Bunny 0.9.x with RubyGems:
83
83
  gem install bunny --pre
84
84
  ```
85
85
 
86
- the most recent 0.9.x version is `0.9.0.rc1`.
86
+ the most recent 0.9.x version is `0.9.0.rc2`.
87
87
 
88
88
  To use Bunny 0.9.x in a project managed with Bundler:
89
89
 
90
90
  ``` ruby
91
- gem "bunny", ">= 0.9.0.rc1" # optionally: , :git => "git://github.com/ruby-amqp/bunny.git", :branch => "master"
91
+ gem "bunny", ">= 0.9.0.rc2" # optionally: , :git => "git://github.com/ruby-amqp/bunny.git", :branch => "master"
92
92
  ```
93
93
 
94
94
 
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bunny'
3
+
4
+ Bundler.setup
5
+
6
+ begin
7
+ connection = Bunny.new(:automatically_recover => false)
8
+ connection.start
9
+
10
+ ch = connection.channel
11
+ q = ch.queue("manually_reconnecting_consumer", :exclusive => true)
12
+
13
+ q.subscribe(:block => true) do |_, _, payload|
14
+ puts "Consumed #{payload}"
15
+ end
16
+ rescue Bunny::NetworkFailure => e
17
+ ch.maybe_kill_consumer_work_pool!
18
+
19
+ sleep 10
20
+ puts "Recovering manually..."
21
+
22
+ retry
23
+ end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+ require 'bunny'
3
+
4
+ Bundler.setup
5
+
6
+ begin
7
+ connection = Bunny.new(:automatically_recover => false)
8
+ connection.start
9
+
10
+ ch = connection.channel
11
+ x = ch.default_exchange
12
+
13
+ loop do
14
+ 10.times do |i|
15
+ print "."
16
+ x.publish("")
17
+ end
18
+
19
+ sleep 3.0
20
+ end
21
+ rescue Bunny::NetworkFailure => e
22
+ ch.maybe_kill_consumer_work_pool!
23
+
24
+ sleep 10
25
+ puts "Recovering manually..."
26
+
27
+ retry
28
+ end
@@ -43,8 +43,6 @@ module Bunny
43
43
  #
44
44
  # This will automatically allocate a channel id.
45
45
  #
46
- # @example Instantiating
47
- #
48
46
  # ## Closing Channels
49
47
  #
50
48
  # Channels are closed via {Bunny::Channel#close}. Channels that get a channel-level exception are
@@ -371,15 +369,15 @@ module Bunny
371
369
 
372
370
  # @group Higher-level API for queue operations
373
371
 
374
- # Declares an exchange or looks it up in the per-channel cache.
372
+ # Declares a queue or looks it up in the per-channel cache.
375
373
  #
376
374
  # @param [String] name Queue name. Pass an empty string to declare a server-named queue (make RabbitMQ generate a unique name).
377
375
  # @param [Hash] opts Queue properties and other options
378
376
  #
379
- # @option options [Boolean] :durable (false) Should this queue be durable?
380
- # @option options [Boolean] :auto-delete (false) Should this queue be automatically deleted when the last consumer disconnects?
381
- # @option options [Boolean] :exclusive (false) Should this queue be exclusive (only can be used by this connection, removed when the connection is closed)?
382
- # @option options [Boolean] :arguments ({}) Additional optional arguments (typically used by RabbitMQ extensions and plugins)
377
+ # @option opts [Boolean] :durable (false) Should this queue be durable?
378
+ # @option opts [Boolean] :auto-delete (false) Should this queue be automatically deleted when the last consumer disconnects?
379
+ # @option opts [Boolean] :exclusive (false) Should this queue be exclusive (only can be used by this connection, removed when the connection is closed)?
380
+ # @option opts [Boolean] :arguments ({}) Additional optional arguments (typically used by RabbitMQ extensions and plugins)
383
381
  #
384
382
  # @return [Bunny::Queue] Queue that was declared or looked up in the cache
385
383
  # @see http://rubybunny.info/articles/queues.html Queues and Consumers guide
@@ -40,6 +40,13 @@ module Bunny
40
40
  # @private
41
41
  CONNECT_TIMEOUT = Transport::DEFAULT_CONNECTION_TIMEOUT
42
42
 
43
+ # @private
44
+ DEFAULT_CONTINUATION_TIMEOUT = if RUBY_VERSION.to_f < 1.9
45
+ 8000
46
+ else
47
+ 4000
48
+ end
49
+
43
50
  # RabbitMQ client metadata
44
51
  DEFAULT_CLIENT_PROPERTIES = {
45
52
  :capabilities => {
@@ -124,7 +131,7 @@ module Bunny
124
131
  end
125
132
  @network_recovery_interval = opts.fetch(:network_recovery_interval, DEFAULT_NETWORK_RECOVERY_INTERVAL)
126
133
  # in ms
127
- @continuation_timeout = opts.fetch(:continuation_timeout, 4000)
134
+ @continuation_timeout = opts.fetch(:continuation_timeout, DEFAULT_CONTINUATION_TIMEOUT)
128
135
 
129
136
  @status = :not_connected
130
137
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "0.9.0.rc2"
5
+ VERSION = "0.9.0"
6
6
  end
@@ -11,9 +11,9 @@ describe Bunny::Consumer, "#cancel" do
11
11
  connection.close if connection.open?
12
12
  end
13
13
 
14
- let(:queue_name) { "bunny.queues.#{rand}" }
14
+ context "with a non-blocking consumer" do
15
+ let(:queue_name) { "bunny.queues.#{rand}" }
15
16
 
16
- context "when the given consumer tag is valid" do
17
17
  it "cancels the consumer" do
18
18
  delivered_data = []
19
19
 
@@ -40,4 +40,37 @@ describe Bunny::Consumer, "#cancel" do
40
40
  delivered_data.should be_empty
41
41
  end
42
42
  end
43
+
44
+
45
+ context "with a blocking consumer" do
46
+ let(:queue_name) { "bunny.queues.#{rand}" }
47
+
48
+ it "cancels the consumer" do
49
+ delivered_data = []
50
+ consumer = nil
51
+
52
+ t = Thread.new do
53
+ ch = connection.create_channel
54
+ q = ch.queue(queue_name, :auto_delete => true, :durable => false)
55
+
56
+ consumer = Bunny::Consumer.new(ch, q)
57
+ consumer.on_delivery do |_, _, payload|
58
+ delivered_data << payload
59
+ end
60
+
61
+ q.subscribe_with(consumer, :block => false)
62
+ end
63
+ t.abort_on_exception = true
64
+ sleep 0.5
65
+
66
+ consumer.cancel
67
+ sleep 0.5
68
+
69
+ ch = connection.create_channel
70
+ ch.default_exchange.publish("", :routing_key => queue_name)
71
+
72
+ sleep 0.7
73
+ delivered_data.should be_empty
74
+ end
75
+ end
43
76
  end
@@ -128,19 +128,15 @@ describe Bunny::Queue, "#subscribe" do
128
128
  ch = connection.create_channel
129
129
  q = ch.queue(queue_name)
130
130
 
131
-
132
-
133
131
  c1 = q.subscribe(:exclusive => false, :manual_ack => false, :block => false) do |delivery_info, properties, payload|
134
132
  end
135
133
  c1.cancel
136
- puts "Cancelled #{c1.consumer_tag}"
137
134
 
138
135
  c2 = q.subscribe(:exclusive => false, :manual_ack => false, :block => false) do |delivery_info, properties, payload|
139
136
  delivered_keys << delivery_info.routing_key
140
137
  delivered_data << payload
141
138
  end
142
139
  c2.cancel
143
- puts "Cancelled #{c2.consumer_tag}"
144
140
 
145
141
  q.subscribe(:exclusive => false, :manual_ack => false, :block => true) do |delivery_info, properties, payload|
146
142
  delivered_keys << delivery_info.routing_key
@@ -160,6 +156,7 @@ describe Bunny::Queue, "#subscribe" do
160
156
 
161
157
  ch.queue(queue_name).message_count.should == 0
162
158
 
159
+ ch.queue_delete(queue_name)
163
160
  ch.close
164
161
  end
165
162
  end
@@ -1,87 +1,89 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "Publishing a message to the default exchange" do
4
- let(:connection) do
5
- c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
6
- c.start
7
- c
8
- end
3
+ if RUBY_VERSION <= "1.9"
4
+ describe "Publishing a message to the default exchange" do
5
+ let(:connection) do
6
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
7
+ c.start
8
+ c
9
+ end
9
10
 
10
- after :all do
11
- connection.close if connection.open?
12
- end
11
+ after :all do
12
+ connection.close if connection.open?
13
+ end
13
14
 
14
15
 
15
- context "with all default delivery and message properties" do
16
- it "routes messages to a queue with the same name as the routing key" do
17
- connection.should be_threaded
18
- ch = connection.create_channel
16
+ context "with all default delivery and message properties" do
17
+ it "routes messages to a queue with the same name as the routing key" do
18
+ connection.should be_threaded
19
+ ch = connection.create_channel
19
20
 
20
- q = ch.queue("", :exclusive => true)
21
- x = ch.default_exchange
21
+ q = ch.queue("", :exclusive => true)
22
+ x = ch.default_exchange
22
23
 
23
- x.publish("xyzzy", :routing_key => q.name).
24
- publish("xyzzy", :routing_key => q.name).
25
- publish("xyzzy", :routing_key => q.name).
26
- publish("xyzzy", :routing_key => q.name)
24
+ x.publish("xyzzy", :routing_key => q.name).
25
+ publish("xyzzy", :routing_key => q.name).
26
+ publish("xyzzy", :routing_key => q.name).
27
+ publish("xyzzy", :routing_key => q.name)
27
28
 
28
- sleep(1)
29
- q.message_count.should == 4
29
+ sleep(1)
30
+ q.message_count.should == 4
30
31
 
31
- ch.close
32
+ ch.close
33
+ end
32
34
  end
33
- end
34
35
 
35
36
 
36
- context "with all default delivery and message properties" do
37
- it "routes the messages and preserves all the metadata" do
38
- connection.should be_threaded
39
- ch = connection.create_channel
37
+ context "with all default delivery and message properties" do
38
+ it "routes the messages and preserves all the metadata" do
39
+ connection.should be_threaded
40
+ ch = connection.create_channel
40
41
 
41
- q = ch.queue("", :exclusive => true)
42
- x = ch.default_exchange
42
+ q = ch.queue("", :exclusive => true)
43
+ x = ch.default_exchange
43
44
 
44
- x.publish("xyzzy", :routing_key => q.name, :persistent => true)
45
+ x.publish("xyzzy", :routing_key => q.name, :persistent => true)
45
46
 
46
- sleep(1)
47
- q.message_count.should == 1
47
+ sleep(1)
48
+ q.message_count.should == 1
48
49
 
49
- envelope, headers, payload = q.pop
50
+ envelope, headers, payload = q.pop
50
51
 
51
- payload.should == "xyzzy"
52
+ payload.should == "xyzzy"
52
53
 
53
- headers[:content_type].should == "application/octet-stream"
54
- headers[:delivery_mode].should == 2
55
- headers[:priority].should == 0
54
+ headers[:content_type].should == "application/octet-stream"
55
+ headers[:delivery_mode].should == 2
56
+ headers[:priority].should == 0
56
57
 
57
- ch.close
58
+ ch.close
59
+ end
58
60
  end
59
- end
60
61
 
61
62
 
62
- context "with all default delivery and message properties on a single-threaded connection" do
63
- let(:connection) do
64
- c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", :threaded => false)
65
- c.start
66
- c
67
- end
63
+ context "with all default delivery and message properties on a single-threaded connection" do
64
+ let(:connection) do
65
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", :threaded => false)
66
+ c.start
67
+ c
68
+ end
68
69
 
69
- it "routes messages to a queue with the same name as the routing key" do
70
- connection.should_not be_threaded
71
- ch = connection.create_channel
70
+ it "routes messages to a queue with the same name as the routing key" do
71
+ connection.should_not be_threaded
72
+ ch = connection.create_channel
72
73
 
73
- q = ch.queue("", :exclusive => true)
74
- x = ch.default_exchange
74
+ q = ch.queue("", :exclusive => true)
75
+ x = ch.default_exchange
75
76
 
76
- x.publish("xyzzy", :routing_key => q.name).
77
- publish("xyzzy", :routing_key => q.name).
78
- publish("xyzzy", :routing_key => q.name).
79
- publish("xyzzy", :routing_key => q.name)
77
+ x.publish("xyzzy", :routing_key => q.name).
78
+ publish("xyzzy", :routing_key => q.name).
79
+ publish("xyzzy", :routing_key => q.name).
80
+ publish("xyzzy", :routing_key => q.name)
80
81
 
81
- sleep(1)
82
- q.message_count.should == 4
82
+ sleep(1)
83
+ q.message_count.should == 4
83
84
 
84
- ch.close
85
+ ch.close
86
+ end
85
87
  end
86
88
  end
87
89
  end
@@ -79,6 +79,8 @@ describe Bunny::Exchange do
79
79
  x.should_not be_durable
80
80
  x.should be_auto_delete
81
81
 
82
+ ch.exchange(name, :type => :fanout, :auto_delete => true)
83
+
82
84
  x.delete
83
85
  ch.close
84
86
  end
@@ -112,6 +114,8 @@ describe Bunny::Exchange do
112
114
  x = ch.direct(name)
113
115
  x.name.should == name
114
116
 
117
+ ch.exchange(name, :type => :direct)
118
+
115
119
  x.delete
116
120
  ch.close
117
121
  end
@@ -139,6 +143,8 @@ describe Bunny::Exchange do
139
143
  x = ch.topic(name)
140
144
  x.name.should == name
141
145
 
146
+ ch.exchange(name, :type => :topic)
147
+
142
148
  x.delete
143
149
  ch.close
144
150
  end
@@ -0,0 +1,85 @@
1
+ require "spec_helper"
2
+
3
+ describe "A message that is proxied by multiple intermediate consumers" do
4
+ let(:c1) do
5
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
6
+ c.start
7
+ c
8
+ end
9
+
10
+ let(:c2) do
11
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
12
+ c.start
13
+ c
14
+ end
15
+
16
+ let(:c3) do
17
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
18
+ c.start
19
+ c
20
+ end
21
+
22
+ let(:c4) do
23
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
24
+ c.start
25
+ c
26
+ end
27
+
28
+ let(:c5) do
29
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
30
+ c.start
31
+ c
32
+ end
33
+
34
+ after :all do
35
+ [c1, c2, c3, c4, c5].each do |c|
36
+ c.close if c.open?
37
+ end
38
+ end
39
+
40
+ # message flow is as follows:
41
+ #
42
+ # x => q4 => q3 => q2 => q1 => xs (results)
43
+ it "reaches its final destination" do
44
+ n = 10000
45
+ xs = []
46
+
47
+ ch1 = c1.create_channel
48
+ q1 = ch1.queue("", :exclusive => true)
49
+ q1.subscribe do |_, _, payload|
50
+ xs << payload
51
+ end
52
+
53
+ ch2 = c2.create_channel
54
+ q2 = ch2.queue("", :exclusive => true)
55
+ q2.subscribe do |_, _, payload|
56
+ q1.publish(payload)
57
+ end
58
+
59
+ ch3 = c3.create_channel
60
+ q3 = ch2.queue("", :exclusive => true)
61
+ q3.subscribe do |_, _, payload|
62
+ q2.publish(payload)
63
+ end
64
+
65
+ ch4 = c4.create_channel
66
+ q4 = ch2.queue("", :exclusive => true)
67
+ q4.subscribe do |_, _, payload|
68
+ q3.publish(payload)
69
+ end
70
+
71
+ ch5 = c5.create_channel
72
+ x = ch5.default_exchange
73
+
74
+ n.times do |i|
75
+ x.publish("msg #{i}", :routing_key => q4.name)
76
+ end
77
+
78
+ t = n / 1000 * 3.0
79
+ puts "About to sleep for #{t} seconds..."
80
+ sleep(t)
81
+
82
+ xs.size.should == n
83
+ xs.last.should == "msg #{n - 1}"
84
+ end
85
+ end
@@ -1,63 +1,65 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "Message framing implementation" do
4
- let(:connection) do
5
- c = Bunny.new(:user => "bunny_gem",
6
- :password => "bunny_password",
7
- :vhost => "bunny_testbed",
8
- :port => ENV.fetch("RABBITMQ_PORT", 5672))
9
- c.start
10
- c
11
- end
3
+ unless ENV["CI"]
4
+ describe "Message framing implementation" do
5
+ let(:connection) do
6
+ c = Bunny.new(:user => "bunny_gem",
7
+ :password => "bunny_password",
8
+ :vhost => "bunny_testbed",
9
+ :port => ENV.fetch("RABBITMQ_PORT", 5672))
10
+ c.start
11
+ c
12
+ end
12
13
 
13
- after :all do
14
- connection.close if connection.open?
15
- end
14
+ after :all do
15
+ connection.close if connection.open?
16
+ end
16
17
 
17
18
 
18
- context "with payload exceeding 128 Kb (max frame size)" do
19
- it "successfully frames the message" do
20
- ch = connection.create_channel
19
+ context "with payload exceeding 128 Kb (max frame size)" do
20
+ it "successfully frames the message" do
21
+ ch = connection.create_channel
21
22
 
22
- q = ch.queue("", :exclusive => true)
23
- x = ch.default_exchange
23
+ q = ch.queue("", :exclusive => true)
24
+ x = ch.default_exchange
24
25
 
25
- as = ("a" * (1024 * 1024 * 4 + 28237777))
26
- x.publish(as, :routing_key => q.name, :persistent => true)
26
+ as = ("a" * (1024 * 1024 * 4 + 28237777))
27
+ x.publish(as, :routing_key => q.name, :persistent => true)
27
28
 
28
- sleep(1)
29
- q.message_count.should == 1
29
+ sleep(1)
30
+ q.message_count.should == 1
30
31
 
31
- _, _, payload = q.pop
32
- payload.bytesize.should == as.bytesize
32
+ _, _, payload = q.pop
33
+ payload.bytesize.should == as.bytesize
33
34
 
34
- ch.close
35
+ ch.close
36
+ end
35
37
  end
36
- end
37
38
 
38
39
 
39
40
 
40
- context "with empty message body" do
41
- it "successfully publishes the message" do
42
- ch = connection.create_channel
41
+ context "with empty message body" do
42
+ it "successfully publishes the message" do
43
+ ch = connection.create_channel
43
44
 
44
- q = ch.queue("", :exclusive => true)
45
- x = ch.default_exchange
45
+ q = ch.queue("", :exclusive => true)
46
+ x = ch.default_exchange
46
47
 
47
- x.publish("", :routing_key => q.name, :persistent => false, :mandatory => true)
48
+ x.publish("", :routing_key => q.name, :persistent => false, :mandatory => true)
48
49
 
49
- sleep(0.5)
50
- q.message_count.should == 1
50
+ sleep(0.5)
51
+ q.message_count.should == 1
51
52
 
52
- envelope, headers, payload = q.pop
53
+ envelope, headers, payload = q.pop
53
54
 
54
- payload.should == ""
55
+ payload.should == ""
55
56
 
56
- headers[:content_type].should == "application/octet-stream"
57
- headers[:delivery_mode].should == 1
58
- headers[:priority].should == 0
57
+ headers[:content_type].should == "application/octet-stream"
58
+ headers[:delivery_mode].should == 1
59
+ headers[:priority].should == 0
59
60
 
60
- ch.close
61
+ ch.close
62
+ end
61
63
  end
62
64
  end
63
65
  end
@@ -0,0 +1,60 @@
1
+ require "spec_helper"
2
+
3
+ describe Bunny::Queue, "#subscribe" do
4
+ let(:publisher_connection) do
5
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed")
6
+ c.start
7
+ c
8
+ end
9
+
10
+ let(:consumer_connection) do
11
+ c = Bunny.new(:user => "bunny_reader", :password => "reader_password", :vhost => "bunny_testbed")
12
+ c.start
13
+ c
14
+ end
15
+
16
+ after :all do
17
+ publisher_connection.close if publisher_connection.open?
18
+ consumer_connection.close if consumer_connection.open?
19
+ end
20
+
21
+ context "with automatic acknowledgement mode" do
22
+ let(:queue_name) { "bunny.basic_consume#{rand}" }
23
+
24
+ it "registers the consumer" do
25
+ delivered_keys = []
26
+ delivered_data = []
27
+
28
+ ch = publisher_connection.create_channel
29
+ # declare the queue because the read-only user won't be able to issue
30
+ # queue.declare
31
+ q = ch.queue(queue_name, :auto_delete => true, :durable => false)
32
+
33
+ t = Thread.new do
34
+ # give the main thread a bit of time to declare the queue
35
+ sleep 0.5
36
+ ch = consumer_connection.create_channel
37
+ # this connection is read only, use passive declare to only get
38
+ # a reference to the queue
39
+ q = ch.queue(queue_name, :auto_delete => true, :durable => false, :passive => true)
40
+ q.subscribe(:exclusive => false) do |delivery_info, properties, payload|
41
+ delivered_keys << delivery_info.routing_key
42
+ delivered_data << payload
43
+ end
44
+ end
45
+ t.abort_on_exception = true
46
+ sleep 0.5
47
+
48
+ x = ch.default_exchange
49
+ x.publish("hello", :routing_key => queue_name)
50
+
51
+ sleep 0.7
52
+ delivered_keys.should include(queue_name)
53
+ delivered_data.should include("hello")
54
+
55
+ ch.queue(queue_name, :auto_delete => true, :durable => false).message_count.should == 0
56
+
57
+ ch.close
58
+ end
59
+ end
60
+ end # describe
@@ -1,15 +1,18 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Bunny::Transport, ".reachable?" do
4
- it "returns true for google.com, 80" do
5
- Bunny::Transport.reacheable?("google.com", 80, 1).should be_true
6
- end
3
+ # mystically fails on Rubinius on CI. MK.
4
+ if RUBY_ENGINE != "rbx"
5
+ describe Bunny::Transport, ".reachable?" do
6
+ it "returns true for google.com, 80" do
7
+ Bunny::Transport.reacheable?("google.com", 80, 1).should be_true
8
+ end
7
9
 
8
- it "returns true for google.com, 8088" do
9
- Bunny::Transport.reacheable?("google.com", 8088, 1).should be_false
10
- end
10
+ it "returns true for google.com, 8088" do
11
+ Bunny::Transport.reacheable?("google.com", 8088, 1).should be_false
12
+ end
11
13
 
12
- it "returns false for google1237982792837.com, 8277" do
13
- Bunny::Transport.reacheable?("google1237982792837.com", 8277, 1).should be_false
14
+ it "returns false for google1237982792837.com, 8277" do
15
+ Bunny::Transport.reacheable?("google1237982792837.com", 8277, 1).should be_false
16
+ end
14
17
  end
15
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bunny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.rc2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Duncan
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-06-27 00:00:00.000000000 Z
15
+ date: 2013-07-12 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -68,6 +68,8 @@ files:
68
68
  - examples/connection/channel_level_exception.rb
69
69
  - examples/connection/disabled_automatic_recovery.rb
70
70
  - examples/connection/heartbeat.rb
71
+ - examples/connection/manually_reconnecting_consumer.rb
72
+ - examples/connection/manually_reconnecting_publisher.rb
71
73
  - examples/connection/unknown_host.rb
72
74
  - examples/guides/exchanges/direct_exchange_routing.rb
73
75
  - examples/guides/exchanges/fanout_exchange_routing.rb
@@ -143,6 +145,7 @@ files:
143
145
  - spec/higher_level_api/integration/exchange_delete_spec.rb
144
146
  - spec/higher_level_api/integration/exchange_unbind_spec.rb
145
147
  - spec/higher_level_api/integration/heartbeat_spec.rb
148
+ - spec/higher_level_api/integration/merry_go_round_spec.rb
146
149
  - spec/higher_level_api/integration/message_properties_access_spec.rb
147
150
  - spec/higher_level_api/integration/predeclared_exchanges_spec.rb
148
151
  - spec/higher_level_api/integration/publisher_confirms_spec.rb
@@ -152,6 +155,7 @@ files:
152
155
  - spec/higher_level_api/integration/queue_delete_spec.rb
153
156
  - spec/higher_level_api/integration/queue_purge_spec.rb
154
157
  - spec/higher_level_api/integration/queue_unbind_spec.rb
158
+ - spec/higher_level_api/integration/read_only_consumer_spec.rb
155
159
  - spec/higher_level_api/integration/sender_selected_distribution_spec.rb
156
160
  - spec/higher_level_api/integration/tls_connection_spec.rb
157
161
  - spec/higher_level_api/integration/tx_commit_spec.rb
@@ -193,9 +197,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
197
  version: '0'
194
198
  required_rubygems_version: !ruby/object:Gem::Requirement
195
199
  requirements:
196
- - - '>'
200
+ - - '>='
197
201
  - !ruby/object:Gem::Version
198
- version: 1.3.1
202
+ version: '0'
199
203
  requirements: []
200
204
  rubyforge_project:
201
205
  rubygems_version: 2.0.3
@@ -228,6 +232,7 @@ test_files:
228
232
  - spec/higher_level_api/integration/exchange_delete_spec.rb
229
233
  - spec/higher_level_api/integration/exchange_unbind_spec.rb
230
234
  - spec/higher_level_api/integration/heartbeat_spec.rb
235
+ - spec/higher_level_api/integration/merry_go_round_spec.rb
231
236
  - spec/higher_level_api/integration/message_properties_access_spec.rb
232
237
  - spec/higher_level_api/integration/predeclared_exchanges_spec.rb
233
238
  - spec/higher_level_api/integration/publisher_confirms_spec.rb
@@ -237,6 +242,7 @@ test_files:
237
242
  - spec/higher_level_api/integration/queue_delete_spec.rb
238
243
  - spec/higher_level_api/integration/queue_purge_spec.rb
239
244
  - spec/higher_level_api/integration/queue_unbind_spec.rb
245
+ - spec/higher_level_api/integration/read_only_consumer_spec.rb
240
246
  - spec/higher_level_api/integration/sender_selected_distribution_spec.rb
241
247
  - spec/higher_level_api/integration/tls_connection_spec.rb
242
248
  - spec/higher_level_api/integration/tx_commit_spec.rb