Class: Synapse::EventSourcing::AggregateFactory Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/event_sourcing/aggregate_factory.rb

Overview

This class is abstract.

Represents a mechanism for creating aggregates to be initialized by an event stream

Direct Known Subclasses

GenericAggregateFactory

Instance Method Summary collapse

Instance Method Details

#aggregate_typeClass

This method is abstract.

Returns Type of aggregate being created by this factory.

Returns:

  • (Class)

    Type of aggregate being created by this factory

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/synapse/event_sourcing/aggregate_factory.rb', line 19

def aggregate_type
  raise NotImplementedError
end

#create_aggregate(aggregate_id, first_event) ⇒ AggregateRoot

This method is abstract.

Instantiates an aggregate using the given aggregate identifier and first event

The first event is either the event used to create the aggregate or the most recent snapshot event for the aggregate.

Parameters:

  • aggregate_id (Object)
  • first_event (DomainEventMessage)

Returns:



15
# File 'lib/synapse/event_sourcing/aggregate_factory.rb', line 15

def create_aggregate(aggregate_id, first_event); end

#type_identifierString

This method is abstract.

Returns Type identifier used to store the aggregate in the event store.

Returns:

  • (String)

    Type identifier used to store the aggregate in the event store

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/synapse/event_sourcing/aggregate_factory.rb', line 25

def type_identifier
  raise NotImplementedError
end