Class: Hutch::Adapters::MarchHareAdapter
- Inherits:
-
Object
- Object
- Hutch::Adapters::MarchHareAdapter
- 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
- .decode_message(delivery_info, payload) ⇒ Object
- .new_exchange(ch, exchange_type, exchange_name, exchange_options) ⇒ Object
Instance Method Summary collapse
- #create_channel(n = nil, consumer_pool_size = 1, consumer_pool_abort_on_exception = false) ⇒ Object
- #current_timestamp ⇒ Object
-
#initialize(opts = {}) ⇒ MarchHareAdapter
constructor
A new instance of MarchHareAdapter.
- #prefetch_channel(ch, prefetch) ⇒ Object
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.(delivery_info, payload) [delivery_info, delivery_info.properties, payload] end |
.new_exchange(ch, exchange_type, exchange_name, exchange_options) ⇒ Object
36 37 38 |
# File 'lib/hutch/adapters/march_hare.rb', line 36 def self.new_exchange(ch, exchange_type, exchange_name, ) MarchHare::Exchange.new(ch, exchange_name, .merge(type: exchange_type)) 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_timestamp ⇒ Object
32 33 34 |
# File 'lib/hutch/adapters/march_hare.rb', line 32 def 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 |