Class: RabbitmqClient::ExchangeRegistry
- Inherits:
-
Object
- Object
- RabbitmqClient::ExchangeRegistry
- Defined in:
- lib/rabbitmq_client/exchange_registry.rb
Overview
ExchangeRegistry is a store for all managed exchanges and their details
Defined Under Namespace
Classes: ExchangeNotFound
Instance Method Summary collapse
- #add(name, type, options = {}) ⇒ Object
- #find(name) ⇒ Object
-
#initialize ⇒ ExchangeRegistry
constructor
A new instance of ExchangeRegistry.
Constructor Details
#initialize ⇒ ExchangeRegistry
Returns a new instance of ExchangeRegistry.
15 16 17 |
# File 'lib/rabbitmq_client/exchange_registry.rb', line 15 def initialize @exchanges = {} end |
Instance Method Details
#add(name, type, options = {}) ⇒ Object
19 20 21 |
# File 'lib/rabbitmq_client/exchange_registry.rb', line 19 def add(name, type, = {}) @exchanges[name] = Exchange.new(name, type, ) end |
#find(name) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/rabbitmq_client/exchange_registry.rb', line 23 def find(name) @exchanges.fetch(name) do ActiveSupport::Notifications.instrument( 'exhange_not_found.rabbitmq_client', name: name ) raise ExchangeNotFound, name end end |