Module: BunnyExchanges

Defined in:
lib/bunny_exchanges.rb,
lib/bunny_exchanges/manager.rb,
lib/bunny_exchanges/version.rb,
lib/bunny_exchanges/configuration.rb

Defined Under Namespace

Classes: Configuration, Manager

Constant Summary collapse

UndefinedExchange =

The required exchange is not defined.

Class.new(StandardError)
VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationConfiguration

BunnyExchanges configuration

Returns:



10
11
12
# File 'lib/bunny_exchanges.rb', line 10

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

A helper to configure BunnyExchanges

Yields:



17
18
19
# File 'lib/bunny_exchanges.rb', line 17

def self.configure
  yield configuration
end

.get(action, connection_name: :default) ⇒ Bunny::Exchange

Delegates ‘#get` to the current manager. Returns the required exchange.

Parameters:

  • the (Symbol, Hash)

    action name and the connection_name

Returns:

  • (Bunny::Exchange)

    the required exchange.

Raises:

See Also:

  • Tenant.using


28
29
30
# File 'lib/bunny_exchanges.rb', line 28

def self.get action, connection_name: :default
  manager.get(action, connection_name)
end

.managerBunnyExchanges::Manager

The current instance of Manager.

Returns:

See Also:

  • Tenant.using


42
43
44
# File 'lib/bunny_exchanges.rb', line 42

def self.manager
  @manager ||= Manager.new(configuration)
end

.reset!Object

Removes the current manager and starts a new one with the same configuration. Useful after forking or in any situation where a reconnection is needed.



34
35
36
# File 'lib/bunny_exchanges.rb', line 34

def self.reset!
  @manager = nil
end