Module: Warren

Defined in:
lib/warren.rb

Overview

Module Warren provides connection pooling for RabbitMQ Connections

Defined Under Namespace

Modules: BroadcastMessages Classes: Broadcast, Log, Message, QueueBroadcastMessage, Test

Class Method Summary collapse

Class Method Details

.construct(type:, config: {}) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/warren.rb', line 5

def self.construct(type:, config: {})
  case type
  when 'test' then Warren::Test.new
  when 'log' then Warren::Log.new
  when 'broadcast' then Warren::Broadcast.new(config)
  else raise StandardError, "Unknown type warren: #{type}"
  end
end

.handlerObject


19
20
21
# File 'lib/warren.rb', line 19

def self.handler
  @handler
end

.setup(opts) ⇒ Object


14
15
16
17
# File 'lib/warren.rb', line 14

def self.setup(opts)
  Rails.logger.warn 'Recreating Warren handler when one already exists' if handler.present?
  @handler = construct(opts.symbolize_keys)
end