bunny 0.9.0.pre13 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +23 -0
  3. data/README.md +2 -2
  4. data/lib/bunny.rb +15 -2
  5. data/lib/bunny/authentication/credentials_encoder.rb +18 -0
  6. data/lib/bunny/authentication/external_mechanism_encoder.rb +1 -0
  7. data/lib/bunny/authentication/plain_mechanism_encoder.rb +2 -0
  8. data/lib/bunny/channel.rb +9 -3
  9. data/lib/bunny/channel_id_allocator.rb +8 -0
  10. data/lib/bunny/concurrent/condition.rb +2 -0
  11. data/lib/bunny/concurrent/continuation_queue.rb +3 -0
  12. data/lib/bunny/concurrent/linked_continuation_queue.rb +3 -0
  13. data/lib/bunny/consumer.rb +2 -0
  14. data/lib/bunny/consumer_tag_generator.rb +1 -0
  15. data/lib/bunny/consumer_work_pool.rb +2 -0
  16. data/lib/bunny/delivery_info.rb +18 -2
  17. data/lib/bunny/exceptions.rb +49 -10
  18. data/lib/bunny/framing.rb +3 -0
  19. data/lib/bunny/heartbeat_sender.rb +4 -1
  20. data/lib/bunny/message_properties.rb +22 -0
  21. data/lib/bunny/queue.rb +49 -0
  22. data/lib/bunny/reader_loop.rb +1 -0
  23. data/lib/bunny/return_info.rb +11 -0
  24. data/lib/bunny/session.rb +53 -19
  25. data/lib/bunny/socket.rb +1 -0
  26. data/lib/bunny/ssl_socket.rb +29 -5
  27. data/lib/bunny/system_timer.rb +2 -0
  28. data/lib/bunny/test_kit.rb +4 -3
  29. data/lib/bunny/transport.rb +41 -25
  30. data/lib/bunny/version.rb +2 -1
  31. data/spec/compatibility/queue_declare_spec.rb +4 -0
  32. data/spec/compatibility/queue_declare_with_default_channel_spec.rb +33 -0
  33. data/spec/higher_level_api/integration/basic_get_spec.rb +35 -0
  34. data/spec/higher_level_api/integration/basic_nack_spec.rb +19 -1
  35. data/spec/higher_level_api/integration/connection_spec.rb +5 -0
  36. data/spec/higher_level_api/integration/queue_unbind_spec.rb +23 -2
  37. data/spec/higher_level_api/integration/tls_connection_spec.rb +47 -0
  38. data/spec/lower_level_api/integration/basic_cancel_spec.rb +8 -1
  39. data/spec/tls/cacert.pem +18 -0
  40. data/spec/tls/client_cert.pem +18 -0
  41. data/spec/tls/client_key.pem +27 -0
  42. data/spec/tls/server_cert.pem +18 -0
  43. data/spec/tls/server_key.pem +27 -0
  44. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b138bcc7caf170e8104ab84dcf9dc4ae89387efa
4
- data.tar.gz: e379d87d1c0fa62e5c84908f530d8160328873cf
3
+ metadata.gz: a3593389008586553f21244193e35c325767ee25
4
+ data.tar.gz: e16cdce6c2dea0e4a01d5847494286e2b64a17ca
5
5
  SHA512:
6
- metadata.gz: f850913f5f76996a6f333ff5bc2a945506c99b1463999b2f912a1602d7f96ff293285d26beb48ddf99cba314f69c6910d38e23858408c11d39a18dc821583dff
7
- data.tar.gz: a12db3df3ad28867e4af5268e5a8f623884649cddc2259ceef6fadbd716099fc7928712857ababe86ad4e336406ea0d3672f8b8d0dd2dab4547475feccf5a41b
6
+ metadata.gz: 292dc01ab77ceb89f4c6dcd8e3a81f91e90167de8df9461a5da6a1466cb9f705c7f18e22ad3286774c5f18e66a21175c73588cfc609321a87f386e91613e08b7
7
+ data.tar.gz: efd54687b032919ed942a985d4a7f9c703110bd35faab173eb97de8c8a02e24de8edd1da0a9b00bb96e1a572afe905142ab637b24f94ab8e1834ea11a7803597
@@ -1,3 +1,26 @@
1
+ ## Changes between Bunny 0.9.0.pre13 and 0.9.0.pre14
2
+
3
+ ### Bunny::Queue#pop_waiting
4
+
5
+ `Bunny::Queue#pop_waiting` is a new function that mimics `Bunny::Queue#pop`
6
+ but will wait until a message is available. It uses a `:timeout` option and will
7
+ raise an exception if the timeout is hit:
8
+
9
+ ``` ruby
10
+ # given 1 message in the queue,
11
+ # works exactly as Bunny::Queue#get
12
+ q.pop_waiting
13
+
14
+ # given no messages in the queue, will wait for up to 0.5 seconds
15
+ # for a message to become available. Raises an exception if the timeout
16
+ # is hit
17
+ q.pop_waiting(:timeout => 0.5)
18
+ ```
19
+
20
+ This method only makes sense for collecting Request/Reply ("RPC") replies.
21
+
22
+
23
+
1
24
  ## Changes between Bunny 0.9.0.pre12 and 0.9.0.pre13
2
25
 
3
26
  ### Channels Without Consumers Now Tear Down Consumer Pools
data/README.md CHANGED
@@ -33,12 +33,12 @@ To install Bunny 0.9.x with RubyGems:
33
33
  gem install bunny --pre
34
34
  ```
35
35
 
36
- the most recent 0.9.x version is `0.9.0.pre11`.
36
+ the most recent 0.9.x version is `0.9.0.pre13`.
37
37
 
38
38
  To use Bunny 0.9.x in a project managed with Bundler:
39
39
 
40
40
  ``` ruby
41
- gem "bunny", ">= 0.9.0.pre11" # optionally: , :git => "git://github.com/ruby-amqp/bunny.git", :branch => "master"
41
+ gem "bunny", ">= 0.9.0.pre13" # optionally: , :git => "git://github.com/ruby-amqp/bunny.git", :branch => "master"
42
42
  ```
43
43
 
44
44
 
@@ -26,7 +26,10 @@ require "bunny/exchange"
26
26
  require "bunny/queue"
27
27
  require "bunny/consumer"
28
28
 
29
+ # Bunny is a RabbitMQ client that focuses on ease of use.
30
+ # @see http://rubybunny.info
29
31
  module Bunny
32
+ # AMQP protocol version Bunny implements
30
33
  PROTOCOL_VERSION = AMQ::Protocol::PROTOCOL_VERSION
31
34
 
32
35
  # unifies Ruby standard library's Timeout (which is not accurate on
@@ -47,15 +50,24 @@ module Bunny
47
50
  # API
48
51
  #
49
52
 
53
+ # @return [String] Bunny version
50
54
  def self.version
51
55
  VERSION
52
56
  end
53
57
 
58
+ # @return [String] AMQP protocol version Bunny implements
54
59
  def self.protocol_version
55
60
  AMQ::Protocol::PROTOCOL_VERSION
56
61
  end
57
62
 
58
-
63
+ # Instantiates a new connection. The actual connection network
64
+ # connection is started with {Bunny::Session#start}
65
+ #
66
+ # @return [Bunny::Session]
67
+ # @see Bunny::Session#start
68
+ # @see http://rubybunny.info/articles/getting_started.html
69
+ # @see http://rubybunny.info/articles/connecting.html
70
+ # @api public
59
71
  def self.new(connection_string_or_opts = {}, opts = {}, &block)
60
72
  if connection_string_or_opts.respond_to?(:keys) && opts.empty?
61
73
  opts = connection_string_or_opts
@@ -71,7 +83,7 @@ module Bunny
71
83
  def self.run(connection_string_or_opts = {}, opts = {}, &block)
72
84
  raise ArgumentError, 'Bunny#run requires a block' unless block
73
85
 
74
- client = Client.new(connection_string_or_opts, opts)
86
+ client = Session.new(connection_string_or_opts, opts)
75
87
 
76
88
  begin
77
89
  client.start
@@ -80,6 +92,7 @@ module Bunny
80
92
  client.stop
81
93
  end
82
94
 
95
+ # backwards compatibility
83
96
  :run_ok
84
97
  end
85
98
  end
@@ -1,27 +1,45 @@
1
1
  module Bunny
2
+ # Contains credentials encoding implementations for various
3
+ # authentication strategies.
2
4
  module Authentication
5
+ # Base credentials encoder. Subclasses implement credentials encoding for
6
+ # a particular authentication mechanism (PLAIN, EXTERNAL, etc).
7
+ #
8
+ # @api plugin
3
9
  class CredentialsEncoder
4
10
 
5
11
  #
6
12
  # API
7
13
  #
8
14
 
15
+ # Session that uses this encoder
16
+ # @return [Bunny::Session]
9
17
  attr_reader :session
10
18
 
19
+ # Instantiates a new encoder for the authentication mechanism
20
+ # used by the provided session.
21
+ #
22
+ # @return [Bunny::CredentialsEncoder]
11
23
  def self.for_session(session)
12
24
  registry[session.mechanism].new(session)
13
25
  end
14
26
 
27
+ # @private
15
28
  def self.registry
16
29
  @@registry ||= Hash.new { raise NotImplementedError }
17
30
  end
18
31
 
32
+ # Registers an encoder for authentication mechanism
33
+ # @api plugin
19
34
  def self.auth_mechanism(*mechanisms)
20
35
  mechanisms.each do |m|
21
36
  registry[m] = self
22
37
  end
23
38
  end
24
39
 
40
+ # Encodes provided credentials according to the specific authentication
41
+ # mechanism
42
+ # @return [String] Encoded credentials
25
43
  def encode_credentials(username, challenge)
26
44
  raise NotImplementedError.new("Subclasses must override this method")
27
45
  end
@@ -2,6 +2,7 @@ require "bunny/authentication/credentials_encoder"
2
2
 
3
3
  module Bunny
4
4
  module Authentication
5
+ # Encodes credentials using the EXTERNAL mechanism
5
6
  class ExternalMechanismEncoder < CredentialsEncoder
6
7
 
7
8
  auth_mechanism "EXTERNAL", "external"
@@ -2,10 +2,12 @@ require "bunny/authentication/credentials_encoder"
2
2
 
3
3
  module Bunny
4
4
  module Authentication
5
+ # Encodes credentials using the PLAIN mechanism
5
6
  class PlainMechanismEncoder < CredentialsEncoder
6
7
 
7
8
  auth_mechanism "PLAIN", "plain"
8
9
 
10
+ # Encodes provided credentials as described in RFC 2595
9
11
  # @api public
10
12
  # @see http://tools.ietf.org/rfc/rfc2595.txt RFC 2595
11
13
  def encode_credentials(username, password)
@@ -127,16 +127,20 @@ module Bunny
127
127
  #
128
128
  # @see http://www.rabbitmq.com/tutorials/amqp-concepts.html AMQP 0.9.1 Model Concepts Guide
129
129
  # @see http://rubybunny.info/articles/getting_started.html Getting Started with RabbitMQ Using Bunny
130
+ # @see http://rubybunny.info/articles/queues.html Queues and Consumers
131
+ # @see http://rubybunny.info/articles/exchanges.html Exchanges and Publishing
130
132
  # @see http://rubybunny.info/articles/error_handling.html Error Handling and Recovery Guide
131
133
  class Channel
132
134
 
133
135
  #
134
136
  # API
135
137
  #
138
+
136
139
  # @return [Integer] Channel id
137
140
  attr_accessor :id
138
141
  # @return [Bunny::Session] AMQP connection this channel was opened on
139
142
  attr_reader :connection
143
+ # @return [Symbol] Channel status (:opening, :open, :closed)
140
144
  attr_reader :status
141
145
  # @return [Bunny::ConsumerWorkPool] Thread pool delivered messages are dispatched to.
142
146
  attr_reader :work_pool
@@ -188,6 +192,7 @@ module Bunny
188
192
  @next_publish_seq_no = 0
189
193
  end
190
194
 
195
+ # @private
191
196
  def read_write_timeout
192
197
  @connection.read_write_timeout
193
198
  end
@@ -1443,6 +1448,7 @@ module Bunny
1443
1448
  # @endgroup
1444
1449
 
1445
1450
 
1451
+ # @return [String] Brief human-readable representation of the channel
1446
1452
  def to_s
1447
1453
  "#<#{self.class.name}:#{object_id} @id=#{self.number} @connection=#{@connection.to_s}>"
1448
1454
  end
@@ -1777,7 +1783,7 @@ module Bunny
1777
1783
  raise ChannelAlreadyClosed.new("cannot use a channel that was already closed! Channel id: #{@id}", self) if closed?
1778
1784
  end
1779
1785
 
1780
- # @api private
1786
+ # @private
1781
1787
  def reset_continuations
1782
1788
  @continuations = new_continuation
1783
1789
  @confirms_continuations = new_continuation
@@ -1786,12 +1792,12 @@ module Bunny
1786
1792
 
1787
1793
 
1788
1794
  if defined?(JRUBY_VERSION)
1789
- # @api private
1795
+ # @private
1790
1796
  def new_continuation
1791
1797
  Concurrent::LinkedContinuationQueue.new
1792
1798
  end
1793
1799
  else
1794
- # @api private
1800
+ # @private
1795
1801
  def new_continuation
1796
1802
  Concurrent::ContinuationQueue.new
1797
1803
  end
@@ -2,6 +2,13 @@ require "thread"
2
2
  require "amq/int_allocator"
3
3
 
4
4
  module Bunny
5
+ # Bitset-based channel id allocator. When channels are closed,
6
+ # ids are released back to the pool.
7
+ #
8
+ # Every connection has its own allocator.
9
+ #
10
+ # Allocating and releasing ids is synchronized and can be performed
11
+ # from multiple threads.
5
12
  class ChannelIdAllocator
6
13
 
7
14
  #
@@ -64,6 +71,7 @@ module Bunny
64
71
  end
65
72
  end
66
73
 
74
+ # @private
67
75
  def synchronize(&block)
68
76
  @mutex.synchronize(&block)
69
77
  end
@@ -1,12 +1,14 @@
1
1
  require "thread"
2
2
 
3
3
  module Bunny
4
+ # @private
4
5
  module Concurrent
5
6
  # Akin to java.util.concurrent.Condition and intrinsic object monitors (Object#wait, Object#notify, Object#notifyAll) in Java:
6
7
  # threads can wait (block until notified) on a condition other threads notify them about.
7
8
  # Unlike the j.u.c. version, this one has a single waiting set.
8
9
  #
9
10
  # Conditions can optionally be annotated with a description string for ease of debugging.
11
+ # @private
10
12
  class Condition
11
13
  attr_reader :waiting_threads, :description
12
14
 
@@ -2,6 +2,9 @@ require "thread"
2
2
 
3
3
  module Bunny
4
4
  module Concurrent
5
+ # Continuation queue implementation for MRI and Rubinius
6
+ #
7
+ # @private
5
8
  class ContinuationQueue
6
9
  def initialize(*args, &block)
7
10
  @q = ::Queue.new(*args)
@@ -9,6 +9,8 @@ java_import java.util.concurrent.TimeUnit
9
9
 
10
10
  module Bunny
11
11
  module Concurrent
12
+ # Continuation queue implementation for JRuby.
13
+ #
12
14
  # On JRuby, we'd rather use reliable and heavily battle tested j.u.c.
13
15
  # primitives with well described semantics than informally specified, clumsy
14
16
  # and limited Ruby standard library parts.
@@ -18,6 +20,7 @@ module Bunny
18
20
  #
19
21
  # Compared to the Ruby standard library Queue, there is one limitation: you cannot
20
22
  # push a nil on the queue, it will fail with a null pointer exception.
23
+ # @private
21
24
  class LinkedContinuationQueue
22
25
  def initialize(*args, &block)
23
26
  @q = LinkedBlockingQueue.new
@@ -79,10 +79,12 @@ module Bunny
79
79
  @channel.basic_cancel(@consumer_tag)
80
80
  end
81
81
 
82
+ # @return [String] More detailed human-readable string representation of this consumer
82
83
  def inspect
83
84
  "#<#{self.class.name}:#{object_id} @channel_id=#{@channel.number} @queue=#{self.queue_name}> @consumer_tag=#{@consumer_tag} @exclusive=#{@exclusive} @no_ack=#{@no_ack}>"
84
85
  end
85
86
 
87
+ # @return [String] Brief human-readable string representation of this consumer
86
88
  def to_s
87
89
  "#<#{self.class.name}:#{object_id} @channel_id=#{@channel.number} @queue=#{self.queue_name}> @consumer_tag=#{@consumer_tag}>"
88
90
  end
@@ -1,4 +1,5 @@
1
1
  module Bunny
2
+ # Used to generate consumer tags in the client
2
3
  class ConsumerTagGenerator
3
4
 
4
5
  #
@@ -3,6 +3,8 @@ require "thread"
3
3
  module Bunny
4
4
  # Thread pool that dispatches consumer deliveries. Not supposed to be shared between channels
5
5
  # or threads.
6
+ #
7
+ # @private
6
8
  class ConsumerWorkPool
7
9
 
8
10
  #
@@ -1,5 +1,5 @@
1
1
  module Bunny
2
- # Wraps AMQ::Protocol::Basic::Deliver to
2
+ # Wraps {AMQ::Protocol::Basic::Deliver} to
3
3
  # provide access to the delivery properties as immutable hash as
4
4
  # well as methods.
5
5
  class DeliveryInfo
@@ -14,8 +14,12 @@ module Bunny
14
14
  # API
15
15
  #
16
16
 
17
- attr_reader :consumer, :channel
17
+ # @return [Bunny::Consumer] Consumer this delivery is for
18
+ attr_reader :consumer
19
+ # @return [Bunny::Channel] Channel this delivery is on
20
+ attr_reader :channel
18
21
 
22
+ # @private
19
23
  def initialize(basic_deliver, consumer, channel)
20
24
  @basic_deliver = basic_deliver
21
25
  @hash = {
@@ -31,43 +35,55 @@ module Bunny
31
35
  @channel = channel
32
36
  end
33
37
 
38
+ # Iterates over the delivery properties
39
+ # @see Enumerable#each
34
40
  def each(*args, &block)
35
41
  @hash.each(*args, &block)
36
42
  end
37
43
 
44
+ # Accesses delivery properties by key
45
+ # @see Hash#[]
38
46
  def [](k)
39
47
  @hash[k]
40
48
  end
41
49
 
50
+ # @return [Hash] Hash representation of this delivery info
42
51
  def to_hash
43
52
  @hash
44
53
  end
45
54
 
55
+ # @private
46
56
  def to_s
47
57
  to_hash.to_s
48
58
  end
49
59
 
60
+ # @private
50
61
  def inspect
51
62
  to_hash.inspect
52
63
  end
53
64
 
65
+ # @return [String] Consumer tag this delivery is for
54
66
  def consumer_tag
55
67
  @basic_deliver.consumer_tag
56
68
  end
57
69
 
70
+ # @return [String] Delivery identifier that is used to acknowledge, reject and nack deliveries
58
71
  def delivery_tag
59
72
  @basic_deliver.delivery_tag
60
73
  end
61
74
 
75
+ # @return [Boolean] true if this delivery is a redelivery (the message was requeued at least once)
62
76
  def redelivered
63
77
  @basic_deliver.redelivered
64
78
  end
65
79
  alias redelivered? redelivered
66
80
 
81
+ # @return [String] Name of the exchange this message was published to
67
82
  def exchange
68
83
  @basic_deliver.exchange
69
84
  end
70
85
 
86
+ # @return [String] Routing key this message was published with
71
87
  def routing_key
72
88
  @basic_deliver.routing_key
73
89
  end
@@ -1,7 +1,14 @@
1
1
  module Bunny
2
+ # Base class for all Bunny exceptions
3
+ # @api public
2
4
  class Exception < ::StandardError
3
5
  end
4
6
 
7
+ # Indicates a network failure. If automatic network
8
+ # recovery mode is enabled, these will be typically handled
9
+ # by the client itself.
10
+ #
11
+ # @api public
5
12
  class NetworkFailure < Exception
6
13
  attr_reader :cause
7
14
 
@@ -11,6 +18,7 @@ module Bunny
11
18
  end
12
19
  end
13
20
 
21
+ # Base class for all channel level exceptions
14
22
  class ChannelLevelException < Exception
15
23
  attr_reader :channel, :channel_close
16
24
 
@@ -22,6 +30,7 @@ module Bunny
22
30
  end
23
31
  end
24
32
 
33
+ # Base class for all connection level exceptions
25
34
  class ConnectionLevelException < Exception
26
35
  attr_reader :connection, :connection_close
27
36
 
@@ -34,6 +43,8 @@ module Bunny
34
43
  end
35
44
 
36
45
 
46
+ # Raised when TCP connection to RabbitMQ fails because of an unresolved
47
+ # hostname, connectivity problem, etc
37
48
  class TCPConnectionFailed < Exception
38
49
  attr_reader :hostname, :port
39
50
 
@@ -48,6 +59,7 @@ module Bunny
48
59
  end
49
60
  end
50
61
 
62
+ # Raised when a frame is sent over an already closed connection
51
63
  class ConnectionClosedError < Exception
52
64
  def initialize(frame)
53
65
  if frame.respond_to?(:method_class)
@@ -58,6 +70,8 @@ module Bunny
58
70
  end
59
71
  end
60
72
 
73
+ # Raised when RabbitMQ closes TCP connection before finishing connection
74
+ # sequence properly. This typically indicates an authentication issue.
61
75
  class PossibleAuthenticationFailureError < Exception
62
76
 
63
77
  #
@@ -76,18 +90,28 @@ module Bunny
76
90
 
77
91
 
78
92
  # backwards compatibility
93
+ # @private
79
94
  ConnectionError = TCPConnectionFailed
95
+ # @private
80
96
  ServerDownError = TCPConnectionFailed
81
97
 
82
- class ForcedChannelCloseError < Exception; end
83
- class ForcedConnectionCloseError < Exception; end
84
- class MessageError < Exception; end
85
- class ProtocolError < Exception; end
86
-
87
- # raised when read or write I/O operations time out (but only if
98
+ # Raised when a channel is closed forcefully using rabbitmqctl
99
+ # or the management UI plugin
100
+ class ForcedChannelCloseError < ChannelLevelException; end
101
+ # Raised when a connection is closed forcefully using rabbitmqctl
102
+ # or the management UI plugin
103
+ class ForcedConnectionCloseError < ConnectionLevelException; end
104
+ # @private
105
+ class MessageError < ConnectionLevelException; end
106
+ # @private
107
+ class ProtocolError < ConnectionLevelException; end
108
+ # Raised when RabbitMQ reports and internal error
109
+ class InternalError < ConnectionLevelException; end
110
+
111
+ # Raised when read or write I/O operations time out (but only if
88
112
  # a connection is configured to use them)
89
113
  class ClientTimeout < Timeout::Error; end
90
- # raised on initial connection timeout
114
+ # Raised on initial TCP connection timeout
91
115
  class ConnectionTimeout < Timeout::Error; end
92
116
 
93
117
 
@@ -116,7 +140,7 @@ module Bunny
116
140
  end
117
141
  end
118
142
 
119
-
143
+ # Raised when a closed channel is used
120
144
  class ChannelAlreadyClosed < Exception
121
145
  attr_reader :channel
122
146
 
@@ -127,31 +151,43 @@ module Bunny
127
151
  end
128
152
  end
129
153
 
154
+ # Raised when RabbitMQ responds with 406 PRECONDITION_FAILED
130
155
  class PreconditionFailed < ChannelLevelException
131
156
  end
132
157
 
158
+ # Raised when RabbitMQ responds with 404 NOT_FOUND
133
159
  class NotFound < ChannelLevelException
134
160
  end
135
161
 
162
+ # Raised when RabbitMQ responds with 405 RESOUCE_LOCKED
136
163
  class ResourceLocked < ChannelLevelException
137
164
  end
138
165
 
166
+ # Raised when RabbitMQ responds with 403 ACCESS_REFUSED
139
167
  class AccessRefused < ChannelLevelException
140
168
  end
141
169
 
142
-
170
+ # Raised when RabbitMQ responds with 504 CHANNEL_ERROR
143
171
  class ChannelError < ConnectionLevelException
144
172
  end
145
173
 
146
- class InvalidCommand < ConnectionLevelException
174
+ # Raised when RabbitMQ responds with 503 COMMAND_INVALID
175
+ class CommandInvalid < ConnectionLevelException
147
176
  end
148
177
 
178
+ # Raised when RabbitMQ responds with 501 FRAME_ERROR
149
179
  class FrameError < ConnectionLevelException
150
180
  end
151
181
 
182
+ # Raised when RabbitMQ responds with 505 UNEXPECTED_FRAME
152
183
  class UnexpectedFrame < ConnectionLevelException
153
184
  end
154
185
 
186
+ # Raised when RabbitMQ responds with 506 RESOURCE_ERROR
187
+ class ResourceError < ConnectionLevelException
188
+ end
189
+
190
+ # @private
155
191
  class NetworkErrorWrapper < Exception
156
192
  attr_reader :other
157
193
 
@@ -161,6 +197,9 @@ module Bunny
161
197
  end
162
198
  end
163
199
 
200
+ # Raised when RabbitMQ responds with 302 CONNECTION_FORCED
201
+ # (which means the connection was closed using rabbitmqctl or
202
+ # RabbitMQ management UI)
164
203
  class ConnectionForced < ConnectionLevelException
165
204
  end
166
205