Class: Eventsourcer::BrokerFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/eventsourcer/broker_factory.rb

Class Method Summary collapse

Class Method Details

.buildObject


3
4
5
6
# File 'lib/eventsourcer/broker_factory.rb', line 3

def self.build
  raise Eventsourcer::Errors::BrokerNotConfiguredError unless Eventsourcer.configuration
  return fetch_broker_klass(Eventsourcer.configuration.broker)
end

.fetch_broker_klass(configured_broker) ⇒ Object


8
9
10
11
12
13
14
# File 'lib/eventsourcer/broker_factory.rb', line 8

def self.fetch_broker_klass(configured_broker)
  if configured_broker == :kafka
    return Eventsourcer::Brokers::KafkaBroker
  else
    raise Eventsourcer::Errors::BrokerNotFound
  end
end