bunny 0.10.8 → 1.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -4
  3. data/ChangeLog.md +1 -152
  4. data/Gemfile +1 -1
  5. data/README.md +5 -5
  6. data/bunny.gemspec +1 -1
  7. data/lib/bunny.rb +14 -2
  8. data/lib/bunny/channel.rb +94 -158
  9. data/lib/bunny/channel_id_allocator.rb +1 -2
  10. data/lib/bunny/concurrent/condition.rb +1 -2
  11. data/lib/bunny/concurrent/continuation_queue.rb +1 -1
  12. data/lib/bunny/consumer.rb +0 -13
  13. data/lib/bunny/consumer_work_pool.rb +2 -5
  14. data/lib/bunny/delivery_info.rb +1 -3
  15. data/lib/bunny/exceptions.rb +1 -4
  16. data/lib/bunny/heartbeat_sender.rb +1 -1
  17. data/lib/bunny/reader_loop.rb +3 -23
  18. data/lib/bunny/session.rb +19 -103
  19. data/lib/bunny/socket.rb +1 -1
  20. data/lib/bunny/transport.rb +7 -31
  21. data/lib/bunny/version.rb +1 -1
  22. data/spec/higher_level_api/integration/basic_ack_spec.rb +19 -34
  23. data/spec/higher_level_api/integration/basic_cancel_spec.rb +1 -1
  24. data/spec/higher_level_api/integration/basic_consume_spec.rb +2 -63
  25. data/spec/higher_level_api/integration/basic_get_spec.rb +1 -1
  26. data/spec/higher_level_api/integration/basic_nack_spec.rb +1 -1
  27. data/spec/higher_level_api/integration/basic_publish_spec.rb +1 -1
  28. data/spec/higher_level_api/integration/basic_qos_spec.rb +8 -5
  29. data/spec/higher_level_api/integration/basic_reject_spec.rb +17 -16
  30. data/spec/higher_level_api/integration/basic_return_spec.rb +1 -1
  31. data/spec/higher_level_api/integration/channel_close_spec.rb +10 -6
  32. data/spec/higher_level_api/integration/channel_flow_spec.rb +9 -6
  33. data/spec/higher_level_api/integration/channel_open_spec.rb +20 -11
  34. data/spec/higher_level_api/integration/confirm_select_spec.rb +1 -1
  35. data/spec/higher_level_api/integration/connection_spec.rb +1 -1
  36. data/spec/higher_level_api/integration/consistent_hash_exchange_spec.rb +1 -1
  37. data/spec/higher_level_api/integration/consumer_cancellation_notification_spec.rb +1 -46
  38. data/spec/higher_level_api/integration/dead_lettering_spec.rb +1 -1
  39. data/spec/higher_level_api/integration/exchange_bind_spec.rb +1 -1
  40. data/spec/higher_level_api/integration/exchange_declare_spec.rb +1 -1
  41. data/spec/higher_level_api/integration/exchange_delete_spec.rb +1 -1
  42. data/spec/higher_level_api/integration/exchange_unbind_spec.rb +1 -1
  43. data/spec/higher_level_api/integration/merry_go_round_spec.rb +1 -1
  44. data/spec/higher_level_api/integration/message_properties_access_spec.rb +1 -1
  45. data/spec/higher_level_api/integration/predeclared_exchanges_spec.rb +1 -1
  46. data/spec/higher_level_api/integration/publishing_edge_cases_spec.rb +1 -1
  47. data/spec/higher_level_api/integration/queue_declare_spec.rb +1 -1
  48. data/spec/higher_level_api/integration/queue_delete_spec.rb +2 -2
  49. data/spec/higher_level_api/integration/queue_purge_spec.rb +1 -1
  50. data/spec/higher_level_api/integration/queue_unbind_spec.rb +2 -2
  51. data/spec/higher_level_api/integration/read_only_consumer_spec.rb +1 -1
  52. data/spec/higher_level_api/integration/sender_selected_distribution_spec.rb +2 -2
  53. data/spec/higher_level_api/integration/tls_connection_spec.rb +2 -86
  54. data/spec/higher_level_api/integration/tx_commit_spec.rb +1 -1
  55. data/spec/higher_level_api/integration/tx_rollback_spec.rb +1 -1
  56. data/spec/unit/concurrent/condition_spec.rb +46 -53
  57. metadata +5 -25
  58. data/benchmarks/mutex_and_monitor.rb +0 -42
  59. data/benchmarks/synchronized_sorted_set.rb +0 -53
  60. data/lib/amq/protocol/extensions.rb +0 -16
  61. data/lib/bunny/concurrent/atomic_fixnum.rb +0 -74
  62. data/lib/bunny/concurrent/synchronized_sorted_set.rb +0 -56
  63. data/lib/bunny/timeout.rb +0 -18
  64. data/lib/bunny/versioned_delivery_tag.rb +0 -28
  65. data/spec/higher_level_api/integration/connection_stop_spec.rb +0 -26
  66. data/spec/higher_level_api/integration/exclusive_queue_spec.rb +0 -28
  67. data/spec/issues/issue141_spec.rb +0 -44
  68. data/spec/stress/connection_open_close_spec.rb +0 -40
  69. data/spec/unit/concurrent/atomic_fixnum_spec.rb +0 -35
  70. data/spec/unit/concurrent/synchronized_sorted_set_spec.rb +0 -73
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Bunny::Session do
4
- it "can be closed" do
5
- c = Bunny.new(:automatically_recover => false)
6
- c.start
7
- ch = c.create_channel
8
-
9
- c.should be_connected
10
- c.stop
11
- c.should be_closed
12
- end
13
- end
14
-
15
-
16
- describe Bunny::Session, "in a single threaded mode" do
17
- it "can be closed" do
18
- c = Bunny.new(:automatically_recover => false, :threaded => false)
19
- c.start
20
- ch = c.create_channel
21
-
22
- c.should be_connected
23
- c.stop
24
- c.should be_closed
25
- end
26
- end
@@ -1,28 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Bunny::Queue 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 "is closed when the connection it was declared on is closed" do
15
- ch1 = connection.create_channel
16
- ch2 = connection.create_channel
17
- q = ch1.queue("", :exclusive => true)
18
-
19
- ch1.queue_declare(q.name, :passive => true)
20
- ch2.queue_declare(q.name, :passive => true)
21
-
22
- ch1.close
23
- ch2.queue_declare(q.name, :passive => true)
24
-
25
- ch2.queue_delete(q.name)
26
- ch2.close
27
- end
28
- end
@@ -1,44 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "Registering 2nd exclusive consumer on queue" 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
-
15
- it "raises a meaningful exception" do
16
- xs = []
17
-
18
- ch1 = connection.create_channel
19
- ch2 = connection.create_channel
20
- q1 = ch1.queue("", :auto_delete => true)
21
- q2 = ch2.queue(q1.name, :auto_delete => true, :passive => true)
22
-
23
- c1 = q1.subscribe(:exclusive => true) do |_, _, payload|
24
- xs << payload
25
- end
26
- sleep 0.1
27
-
28
- lambda do
29
- q2.subscribe(:exclusive => true) do |_, _, _|
30
- end
31
- end.should raise_error(Bunny::AccessRefused)
32
-
33
- ch1.should be_open
34
- ch2.should be_closed
35
-
36
- q1.publish("abc")
37
- sleep 0.1
38
-
39
- # verify that the first consumer is fine
40
- xs.should == ["abc"]
41
-
42
- q1.delete
43
- end
44
- end
@@ -1,40 +0,0 @@
1
- require "spec_helper"
2
-
3
- unless defined?(JRUBY_VERSION) && !ENV["FORCE_JRUBY_RUN"]
4
- describe Bunny::Session do
5
- # creating thousands of connections means creating
6
- # twice as many threads and this won't fly with the JVM
7
- # in CI containers. MK.
8
- n = if defined?(JRUBY_VERSION)
9
- 250
10
- else
11
- 2500
12
- end
13
-
14
- n.times do |i|
15
- it "can be closed (take #{i})" do
16
- c = Bunny.new(:automatically_recover => false)
17
- c.start
18
- ch = c.create_channel
19
-
20
- c.should be_connected
21
- c.stop
22
- c.should be_closed
23
- end
24
- end
25
-
26
- context "in the single threaded mode" do
27
- n.times do |i|
28
- it "can be closed (take #{i})" do
29
- c = Bunny.new(:automatically_recover => false, :threaded => false)
30
- c.start
31
- ch = c.create_channel
32
-
33
- c.should be_connected
34
- c.stop
35
- c.should be_closed
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,35 +0,0 @@
1
- require "spec_helper"
2
- require "bunny/concurrent/atomic_fixnum"
3
-
4
- describe Bunny::Concurrent::AtomicFixnum do
5
- it "allows retrieving the current value" do
6
- af = described_class.new(0)
7
-
8
- af.get.should == 0
9
- af.should == 0
10
- end
11
-
12
- it "can be updated" do
13
- af = described_class.new(0)
14
-
15
- af.get.should == 0
16
- Thread.new do
17
- af.set(10)
18
- end
19
- sleep 0.6
20
- af.get.should == 10
21
- end
22
-
23
- it "can be incremented" do
24
- af = described_class.new(0)
25
-
26
- af.get.should == 0
27
- 10.times do
28
- Thread.new do
29
- af.increment
30
- end
31
- end
32
- sleep 0.6
33
- af.get.should == 10
34
- end
35
- end
@@ -1,73 +0,0 @@
1
- require "spec_helper"
2
- require "bunny/concurrent/synchronized_sorted_set"
3
-
4
- unless ENV["CI"]
5
- describe Bunny::Concurrent::SynchronizedSortedSet do
6
- 50.times do |i|
7
- it "provides the same API as SortedSet for key operations (take #{i})" do
8
- s = described_class.new
9
- s.length.should == 0
10
-
11
- s << 1
12
- s.length.should == 1
13
- s << 1
14
- s.length.should == 1
15
- s << 2
16
- s.length.should == 2
17
- s << 3
18
- s.length.should == 3
19
- s << 4
20
- s.length.should == 4
21
- s << 4
22
- s << 4
23
- s << 4
24
- s.length.should == 4
25
- s << 5
26
- s.length.should == 5
27
- s << 5
28
- s << 5
29
- s << 5
30
- s.length.should == 5
31
- s << 6
32
- s.length.should == 6
33
- s << 7
34
- s.length.should == 7
35
- s << 8
36
- s.length.should == 8
37
- s.delete 8
38
- s.length.should == 7
39
- s.delete_if { |i| i == 1 }
40
- s.length.should == 6
41
- end
42
- it "synchronizes common operations needed by Bunny (take #{i})" do
43
- s = described_class.new
44
- s.length.should == 0
45
-
46
- 10.times do
47
- Thread.new do
48
- s << 1
49
- s << 1
50
- s << 2
51
- s << 3
52
- s << 4
53
- s << 4
54
- s << 4
55
- s << 4
56
- s << 5
57
- s << 5
58
- s << 5
59
- s << 5
60
- s << 6
61
- s << 7
62
- s << 8
63
- s.delete 8
64
- s.delete_if { |i| i == 1 }
65
- end
66
- end
67
- sleep 0.5
68
-
69
- s.length.should == 6
70
- end
71
- end
72
- end
73
- end