bunny 1.1.0.pre2 → 1.1.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 843f81c989d0b413c14b8874bb6f2e4365da3921
4
- data.tar.gz: b4fcd0d7a8e3effe884f2b3ecefc2db524aaf545
3
+ metadata.gz: 73298a109694af83bb99bf84847d60df16207fcf
4
+ data.tar.gz: 7b5f3f2aa6f0f790fb9384e1ba08924e6ba60063
5
5
  SHA512:
6
- metadata.gz: dee6d9086ff1654324c354037d1a35875b2ded96a1b0701c9836d5d2e4d41ff83df212ac5efca7643e50c30304f0be360ddbd4f6d64470634348b625a71f0016
7
- data.tar.gz: 3fd0c4d92be3121789bf4dc7349583c24de9534cafb3a686fef5e080211c708a02ba15aef7e555c29c2dec2567439f8dcc11c6889da0788e272703b355b3ac28
6
+ metadata.gz: bede6aee3aa9976eeb91f016bc7214b90756d96b105e3a81c3214e0497a0500f3c5738af97a0674e028bacbcf9c7cde779dcd8ab4afefef2ba59ad539044885c
7
+ data.tar.gz: cbcacfc53117c4a3a68e78ce0d3a6c4c817c81780cf2a3f0b5f0ed613a56ed5784d743521e0e535a447612522433136de3950720c8846bbbf2cb54b72a0e1223
data/.travis.yml CHANGED
@@ -3,11 +3,12 @@ bundler_args: --without development
3
3
  before_script: "./bin/ci/before_build.sh"
4
4
  script: "bundle exec rspec -cfs spec"
5
5
  rvm:
6
+ - "2.1.0-preview2"
6
7
  - "2.0"
7
8
  - "1.9.3"
8
- - "jruby-19mode"
9
+ - "jruby"
9
10
  - "1.9.2"
10
- - "rbx-19mode"
11
+ - "rbx"
11
12
  - "1.8.7"
12
13
  notifications:
13
14
  email: michael@rabbitmq.com
@@ -19,5 +20,6 @@ branches:
19
20
  - 0.9.x-stable
20
21
  matrix:
21
22
  allow_failures:
22
- - rvm: rbx-19mode
23
- - rvm: 1.8.7
23
+ - rvm: rbx
24
+ - rvm: "1.8.7"
25
+ - rvm: jruby
data/ChangeLog.md CHANGED
@@ -1,3 +1,42 @@
1
+ ## Changes between Bunny 1.1.0.pre2 and 1.1.0.rc1
2
+
3
+ ### Full Channel State Recovery
4
+
5
+ Channel recovery now involves recovery of publisher confirms and
6
+ transaction modes.
7
+
8
+
9
+ ### TLS Without Peer Verification
10
+
11
+ Bunny now successfully performs TLS upgrade when peer verification
12
+ is disabled.
13
+
14
+ Contributed by Jordan Curzon.
15
+
16
+ ### Bunny::Session#with_channel Ensures the Channel is Closed
17
+
18
+ `Bunny::Session#with_channel` now makes sure the channel is closed
19
+ even if provided block raises an exception
20
+
21
+ Contributed by Carl Hoerberg.
22
+
23
+
24
+
25
+ ### Channel Number = 0 is Rejected
26
+
27
+ `Bunny::Session#create_channel` will now reject channel number 0.
28
+
29
+
30
+ ### Single Threaded Mode Fixes
31
+
32
+ Single threaded mode no longer fails with
33
+
34
+ ```
35
+ undefined method `event_loop'
36
+ ```
37
+
38
+
39
+
1
40
  ## Changes between Bunny 1.1.0.pre1 and 1.1.0.pre2
2
41
 
3
42
  ### connection.tune.channel_max No Longer Overflows
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 – 2013 Chris Duncan, Jakub Stastny aka botanicus,
1
+ Copyright (c) 2009 – 2014 Chris Duncan, Jakub Stastny aka botanicus,
2
2
  Michael S. Klishin, Eric Lindvall, Stefan Kaes and contributors.
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -219,3 +219,7 @@ on GitHub.
219
219
  ## License
220
220
 
221
221
  Released under the MIT license.
222
+
223
+
224
+ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ruby-amqp/bunny/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
225
+
data/bunny.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
29
29
  map { |mail| Base64.decode64(mail) }
30
30
 
31
31
  # Dependencies
32
- s.add_dependency "amq-protocol", ">= 1.9.0"
32
+ s.add_dependency "amq-protocol", ">= 1.9.2"
33
33
 
34
34
  # Files.
35
35
  s.has_rdoc = true
data/lib/bunny/channel.rb CHANGED
@@ -1281,6 +1281,7 @@ module Bunny
1281
1281
  @last_tx_select_ok = wait_on_continuations
1282
1282
  end
1283
1283
  raise_if_continuation_resulted_in_a_channel_error!
1284
+ @tx_mode = true
1284
1285
 
1285
1286
  @last_tx_select_ok
1286
1287
  end
@@ -1350,6 +1351,7 @@ module Bunny
1350
1351
  Bunny::Timeout.timeout(read_write_timeout, ClientTimeout) do
1351
1352
  @last_confirm_select_ok = wait_on_continuations
1352
1353
  end
1354
+ @confirm_mode = true
1353
1355
  raise_if_continuation_resulted_in_a_channel_error!
1354
1356
  @last_confirm_select_ok
1355
1357
  end
@@ -1420,6 +1422,8 @@ module Bunny
1420
1422
  release_all_continuations
1421
1423
 
1422
1424
  recover_prefetch_setting
1425
+ recover_confirm_flag
1426
+ recover_tx_mode
1423
1427
  recover_exchanges
1424
1428
  # this includes recovering bindings
1425
1429
  recover_queues
@@ -1435,6 +1439,22 @@ module Bunny
1435
1439
  basic_qos(@prefetch_count) if @prefetch_count
1436
1440
  end
1437
1441
 
1442
+ # Recovers publisher confirms mode. Used by the Automatic Network Failure
1443
+ # Recovery feature.
1444
+ #
1445
+ # @api plugin
1446
+ def recover_confirm_mode
1447
+ confirm_select if @confirm_mode
1448
+ end
1449
+
1450
+ # Recovers transaction mode. Used by the Automatic Network Failure
1451
+ # Recovery feature.
1452
+ #
1453
+ # @api plugin
1454
+ def recover_tx_mode
1455
+ tx_select if @tx_mode
1456
+ end
1457
+
1438
1458
  # Recovers exchanges. Used by the Automatic Network Failure
1439
1459
  # Recovery feature.
1440
1460
  #
@@ -1681,7 +1701,7 @@ module Bunny
1681
1701
  @threads_waiting_on_basic_get_continuations.delete(t)
1682
1702
  end
1683
1703
  else
1684
- connection.event_loop.run_once until @basic_get_continuations.length > 0
1704
+ connection.reader_loop.run_once until @basic_get_continuations.length > 0
1685
1705
 
1686
1706
  @basic_get_continuations.pop
1687
1707
  end
@@ -1699,7 +1719,7 @@ module Bunny
1699
1719
  @threads_waiting_on_confirms_continuations.delete(t)
1700
1720
  end
1701
1721
  else
1702
- connection.event_loop.run_once until @confirms_continuations.length > 0
1722
+ connection.reader_loop.run_once until @confirms_continuations.length > 0
1703
1723
 
1704
1724
  @confirms_continuations.pop
1705
1725
  end
@@ -82,10 +82,10 @@ module Bunny
82
82
 
83
83
  begin
84
84
  callable.call
85
- rescue Exception => e
86
- # TODO
87
- puts e.class.name
88
- puts e.message
85
+ rescue ::Exception => e
86
+ # TODO: use connection logger
87
+ $stderr.puts e.class.name
88
+ $stderr.puts e.message
89
89
  end
90
90
  end
91
91
  end
data/lib/bunny/session.rb CHANGED
@@ -273,6 +273,8 @@ module Bunny
273
273
  #
274
274
  # @return [Bunny::Channel] Newly opened channel
275
275
  def create_channel(n = nil, consumer_pool_size = 1)
276
+ raise ArgumentError, "channel number 0 is reserved in the protocol and cannot be used" if 0 == n
277
+
276
278
  if n && (ch = @channels[n])
277
279
  ch
278
280
  else
@@ -307,8 +309,11 @@ module Bunny
307
309
  # @return [Bunny::Session] self
308
310
  def with_channel(n = nil)
309
311
  ch = create_channel(n)
310
- yield ch
311
- ch.close if ch.open?
312
+ begin
313
+ yield ch
314
+ ensure
315
+ ch.close if ch.open?
316
+ end
312
317
 
313
318
  self
314
319
  end
@@ -368,7 +368,14 @@ module Bunny
368
368
  # setting TLS/SSL version only works correctly when done
369
369
  # vis set_params. MK.
370
370
  ctx.set_params(:ssl_version => @opts.fetch(:tls_protocol, DEFAULT_TLS_PROTOCOL))
371
- ctx.set_params(:verify_mode => OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT) if @verify_peer
371
+
372
+ verify_mode = if @verify_peer
373
+ OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
374
+ else
375
+ OpenSSL::SSL::VERIFY_NONE
376
+ end
377
+
378
+ ctx.set_params(:verify_mode => verify_mode)
372
379
 
373
380
  ctx
374
381
  end
data/lib/bunny/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Bunny
4
4
  # @return [String] Version of the library
5
- VERSION = "1.1.0.pre2"
5
+ VERSION = "1.1.0.rc1"
6
6
  end
@@ -21,6 +21,15 @@ describe Bunny::Channel, "when opened" do
21
21
  end
22
22
  end
23
23
 
24
+ context "with an explicitly provided id = 0" do
25
+ it "raises ArgumentError" do
26
+ connection.should be_connected
27
+ expect {
28
+ connection.create_channel(0)
29
+ }.to raise_error(ArgumentError)
30
+ end
31
+ end
32
+
24
33
 
25
34
  context "with explicitly provided id" do
26
35
  it "uses that id and is successfully opened" do
@@ -38,4 +38,40 @@ describe Bunny::Channel do
38
38
  ch.close
39
39
  end
40
40
  end
41
+
42
+
43
+ context "with a single-threaded connection" do
44
+ let(:connection) do
45
+ c = Bunny.new(:user => "bunny_gem", :password => "bunny_password", :vhost => "bunny_testbed", :continuation_timeout => 10000, :threaded => false)
46
+ c.start
47
+ c
48
+ end
49
+
50
+
51
+ context "when publishing with confirms enabled" do
52
+ it "increments delivery index" do
53
+ ch = connection.create_channel
54
+ ch.should_not be_using_publisher_confirmations
55
+
56
+ ch.confirm_select
57
+ ch.should be_using_publisher_confirmations
58
+
59
+ q = ch.queue("", :exclusive => true)
60
+ x = ch.default_exchange
61
+
62
+ n.times do
63
+ x.publish("xyzzy", :routing_key => q.name)
64
+ end
65
+
66
+ ch.next_publish_seq_no.should == n + 1
67
+ ch.wait_for_confirms.should be_true
68
+ sleep 0.25
69
+
70
+ q.message_count.should == n
71
+ q.purge
72
+
73
+ ch.close
74
+ end
75
+ end
76
+ end
41
77
  end
@@ -0,0 +1,25 @@
1
+ require "spec_helper"
2
+
3
+ describe Bunny::Channel, "#with_channel" 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
9
+
10
+ after :each do
11
+ connection.close if connection.open?
12
+ end
13
+
14
+ it "closes if the block throws an exception" do
15
+ ch = nil
16
+ begin
17
+ connection.with_channel do |wch|
18
+ ch = wch
19
+ raise Exception.new
20
+ end
21
+ rescue Exception
22
+ end
23
+ ch.should be_closed
24
+ end
25
+ 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: 1.1.0.pre2
4
+ version: 1.1.0.rc1
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-11-25 00:00:00.000000000 Z
15
+ date: 2014-01-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: amq-protocol
@@ -20,14 +20,14 @@ dependencies:
20
20
  requirements:
21
21
  - - '>='
22
22
  - !ruby/object:Gem::Version
23
- version: 1.9.0
23
+ version: 1.9.2
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - '>='
29
29
  - !ruby/object:Gem::Version
30
- version: 1.9.0
30
+ version: 1.9.2
31
31
  description: Easy to use, feature complete Ruby client for RabbitMQ 2.0 and later
32
32
  versions.
33
33
  email:
@@ -178,6 +178,7 @@ files:
178
178
  - spec/higher_level_api/integration/tls_connection_spec.rb
179
179
  - spec/higher_level_api/integration/tx_commit_spec.rb
180
180
  - spec/higher_level_api/integration/tx_rollback_spec.rb
181
+ - spec/higher_level_api/integration/with_channel_spec.rb
181
182
  - spec/issues/issue100_spec.rb
182
183
  - spec/issues/issue141_spec.rb
183
184
  - spec/issues/issue78_spec.rb
@@ -273,6 +274,7 @@ test_files:
273
274
  - spec/higher_level_api/integration/tls_connection_spec.rb
274
275
  - spec/higher_level_api/integration/tx_commit_spec.rb
275
276
  - spec/higher_level_api/integration/tx_rollback_spec.rb
277
+ - spec/higher_level_api/integration/with_channel_spec.rb
276
278
  - spec/issues/issue100_spec.rb
277
279
  - spec/issues/issue141_spec.rb
278
280
  - spec/issues/issue78_spec.rb