Class: RabbitmqClient::ExchangeRegistry

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeExchangeRegistry

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, options = {})
  @exchanges[name] = Exchange.new(name, type, options)
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