Class: Rmsg::Rabbit

Inherits:
Object
  • Object
show all
Defined in:
lib/rmsg/rabbit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRabbit

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

#channelBunny::Channel (readonly)

Returns:

  • (Bunny::Channel)


6
7
8
# File 'lib/rmsg/rabbit.rb', line 6

def channel
  @channel
end

#connectionBunny::Connection (readonly)

Returns:

  • (Bunny::Connection)


4
5
6
# File 'lib/rmsg/rabbit.rb', line 4

def connection
  @connection
end

Instance Method Details

#closeObject

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