Class: Hutch::Adapters::BunnyAdapter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/hutch/adapters/bunny.rb

Constant Summary collapse

DEFAULT_VHOST =
Bunny::Session::DEFAULT_VHOST
ConnectionRefused =
Bunny::TCPConnectionFailed
PreconditionFailed =
Bunny::PreconditionFailed

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ BunnyAdapter

Returns a new instance of BunnyAdapter.



16
17
18
# File 'lib/hutch/adapters/bunny.rb', line 16

def initialize(opts={})
  @connection = Bunny.new(opts)
end

Class Method Details

.decode_message(delivery_info, properties, payload) ⇒ Object



20
21
22
# File 'lib/hutch/adapters/bunny.rb', line 20

def self.decode_message(delivery_info, properties, payload)
  [delivery_info, properties, payload]
end

.new_exchange(ch, exchange_type, exchange_name, exchange_options) ⇒ Object



32
33
34
# File 'lib/hutch/adapters/bunny.rb', line 32

def self.new_exchange(ch, exchange_type, exchange_name, exchange_options)
  Bunny::Exchange.new(ch, exchange_type, exchange_name, exchange_options)
end

Instance Method Details

#current_timestampObject



28
29
30
# File 'lib/hutch/adapters/bunny.rb', line 28

def current_timestamp
  Time.now.to_i
end

#prefetch_channel(ch, prefetch) ⇒ Object



24
25
26
# File 'lib/hutch/adapters/bunny.rb', line 24

def prefetch_channel(ch, prefetch)
  ch.prefetch(prefetch) if prefetch
end