Class: BitBroker::Broker

Inherits:
Object
  • Object
show all
Defined in:
lib/bitbroker/broker.rb

Overview

This method communicate with AMQP for transmitting and receiving data

Direct Known Subclasses

Publisher, Subscriber

Constant Summary collapse

RKEY_DATA =
'data'
RKEY_METADATA =
'metadata'
ENCRYPT_ALGORITHM =
"AES-256-CBC"

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Broker

Returns a new instance of Broker.



12
13
14
15
16
17
18
19
20
21
# File 'lib/bitbroker/broker.rb', line 12

def initialize(config)
  @connection = Bunny.new(:host     => config[:mqconfig]['host'],
                          :vhost    => config[:mqconfig]['vhost'],
                          :user     => config[:mqconfig]['user'],
                          :password => config[:mqconfig]['passwd'])
  @connection.start
  @channel = @connection.create_channel
  @exchange = @channel.direct(config[:label])
  @passwd = config[:passwd].to_s + config[:label]
end

Instance Method Details

#finishObject



23
24
25
26
# File 'lib/bitbroker/broker.rb', line 23

def finish
  @channel.close
  @connection.close
end