Method: MessageBus::Implementation#backend_instance

Defined in:
lib/message_bus.rb

#backend_instanceMessageBus::Backend::Base

Returns the configured backend. If not explicitly set, will be loaded based on the configuration provided.

Returns:

  • (MessageBus::Backend::Base)

    the configured backend. If not explicitly set, will be loaded based on the configuration provided.

[View source]

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/message_bus.rb', line 300

def backend_instance
  @mutex.synchronize do
    return nil if @destroyed

    # Make sure logger is loaded before config is
    # passed to backend.
    logger

    @config[:backend_instance] ||= begin
      @config[:backend_options] ||= {}
      require "message_bus/backends/#{backend}"
      MessageBus::BACKENDS[backend].new @config
    end
  end
end