Class: Rmsg::Rabbit
- Inherits:
-
Object
- Object
- Rmsg::Rabbit
- Defined in:
- lib/rmsg/rabbit.rb
Instance Attribute Summary collapse
- #channel ⇒ Bunny::Channel readonly
- #connection ⇒ Bunny::Connection readonly
Instance Method Summary collapse
-
#close ⇒ Object
Close the channel and the connection to RabbitMQ.
-
#initialize ⇒ Rabbit
constructor
On creation holds references to RabbitMQ via a Bunny connection and a Bunny channel.
Constructor Details
#initialize ⇒ Rabbit
On creation holds references to RabbitMQ via a Bunny connection and a Bunny channel.
10 11 12 13 14 |
# File 'lib/rmsg/rabbit.rb', line 10 def initialize @connection = Bunny.new @connection.start @channel = @connection.create_channel end |
Instance Attribute Details
#channel ⇒ Bunny::Channel (readonly)
6 7 8 |
# File 'lib/rmsg/rabbit.rb', line 6 def channel @channel end |
#connection ⇒ Bunny::Connection (readonly)
4 5 6 |
# File 'lib/rmsg/rabbit.rb', line 4 def connection @connection end |
Instance Method Details
#close ⇒ Object
Close the channel and the connection to RabbitMQ.
17 18 19 20 |
# File 'lib/rmsg/rabbit.rb', line 17 def close @channel.close @connection.close end |