Class: BunnyExchanges::Manager
- Inherits:
-
Object
- Object
- BunnyExchanges::Manager
- Defined in:
- lib/bunny_exchanges/manager.rb
Overview
Class keeps all configured exchanges through the same connection and channel.
Instance Method Summary collapse
-
#get(action, connection_name) ⇒ Bunny::Exchange
Gets or builds the required exchange.
-
#initialize(config = BunnyExchanges.configuration) ⇒ Manager
constructor
Constructor.
Constructor Details
#initialize(config = BunnyExchanges.configuration) ⇒ Manager
Constructor.
12 13 14 15 16 |
# File 'lib/bunny_exchanges/manager.rb', line 12 def initialize config = BunnyExchanges.configuration @config = config @exchanges = {} @channels = {} end |
Instance Method Details
#get(action, connection_name) ⇒ Bunny::Exchange
Gets or builds the required exchange.
23 24 25 26 27 28 29 |
# File 'lib/bunny_exchanges/manager.rb', line 23 def get action, connection_name exchanges[action.to_sym] ||= begin name, = params_for(action) channel_for(connection_name).exchange(name, ) end end |