Class: Burrow::Connection
- Inherits:
-
Object
- Object
- Burrow::Connection
- Defined in:
- lib/burrow/connection.rb
Instance Attribute Summary collapse
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
Instance Method Summary collapse
- #channel ⇒ Object
- #connection ⇒ Object
- #exchange ⇒ Object
-
#initialize(queue_name) ⇒ Connection
constructor
A new instance of Connection.
- #queue ⇒ Object
- #return_queue ⇒ Object
Constructor Details
#initialize(queue_name) ⇒ Connection
Returns a new instance of Connection.
5 6 7 |
# File 'lib/burrow/connection.rb', line 5 def initialize(queue_name) @queue_name = queue_name end |
Instance Attribute Details
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
3 4 5 |
# File 'lib/burrow/connection.rb', line 3 def queue_name @queue_name end |
Instance Method Details
#channel ⇒ Object
17 18 19 |
# File 'lib/burrow/connection.rb', line 17 def channel @channel ||= connection.create_channel end |
#connection ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/burrow/connection.rb', line 9 def connection @connection ||= begin c = Bunny.new c.start c end end |
#exchange ⇒ Object
25 26 27 |
# File 'lib/burrow/connection.rb', line 25 def exchange @exchange ||= channel.default_exchange end |
#queue ⇒ Object
21 22 23 |
# File 'lib/burrow/connection.rb', line 21 def queue @queue ||= channel.queue(queue_name, auto_delete: false) end |
#return_queue ⇒ Object
29 30 31 |
# File 'lib/burrow/connection.rb', line 29 def return_queue @return_queue ||= channel.queue('', exclusive: true) end |