Class: Hutch::Adapters::MarchHareAdapter

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

Constant Summary collapse

DEFAULT_VHOST =
"/"
ConnectionRefused =
MarchHare::ConnectionRefused
PreconditionFailed =
MarchHare::PreconditionFailed

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ MarchHareAdapter

Returns a new instance of MarchHareAdapter.



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

def initialize(opts = {})
  @connection = MarchHare.connect(opts)
end

Class Method Details

.decode_message(delivery_info, payload) ⇒ Object



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

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

Instance Method Details

#create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false) ⇒ Object



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

def create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false)
  @connection.create_channel(n)
end

#current_timestampObject



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

def current_timestamp
  Time.now
end

#prefetch_channel(ch, prefetch) ⇒ Object



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

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