Class EventSourcingLockingAggregate<C, S, E, V>

Event sourcing locking aggregate is using/delegating a EventSourcingLockingAggregate.decider of type IDecider<C, S, E> to handle commands and produce events. In order to handle the command, aggregate needs to fetch the current state (represented as a list of events) via EventLockingRepository.fetchEvents function, and then delegate the command to the EventSourcingLockingAggregate.decider which can produce new event(s) as a result.

Produced events are then stored via EventLockingRepository.save function.

Type Param: E

Version

Author

Иван Дугалић / Ivan Dugalic /

Idugalic

Type Parameters

  • C

    Commands of type C that this aggregate can handle

  • S

    Aggregate state of type S

  • E

    Events of type E that this aggregate can publish

  • V

Hierarchy

Implements

Constructors

Properties

decider: IDecider<C, S, E>
eventRepository: EventLockingRepository<C, E, V>
initialState: S

Methods

  • Save events

    Parameters

    • eList: readonly E[]

      list of Events of type E

    • latestVersion: null | V

      Latest Event in this stream and its Version

    Returns Promise<readonly (readonly [E, V])[]>

    a list of pairs of newly saved Event of type E and its Version of type V

Generated using TypeDoc