Module: Eventsourcer

Defined in:
lib/eventsourcer.rb,
lib/eventsourcer/errors.rb,
lib/eventsourcer/version.rb,
lib/eventsourcer/brokers/base.rb,
lib/eventsourcer/broker_factory.rb,
lib/eventsourcer/brokers/kafka_broker.rb

Defined Under Namespace

Modules: Brokers, Errors Classes: BrokerFactory, Configuration

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration


9
10
11
# File 'lib/eventsourcer.rb', line 9

def configuration
  @configuration
end

Class Method Details

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

Yields:


12
13
14
15
# File 'lib/eventsourcer.rb', line 12

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.included(base) ⇒ Object


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

def self.included(base)
  base.send :after_commit, :publish if base.respond_to?(:after_commit)
end

Instance Method Details

#publishObject


32
33
34
35
# File 'lib/eventsourcer.rb', line 32

def publish
  @publisher ||= Eventsourcer::BrokerFactory.build
  @publisher.publish(table_name: self.class.table_name, previous_changes: previous_changes)
end