Annotation Interface Aggregate


  • Element Details

    • eventSourced

      boolean eventSourced
      Default:
      true
    • ignoreUnknownEvents

      boolean ignoreUnknownEvents
      Default:
      false
    • snapshotPeriod

      int snapshotPeriod
      Default:
      0
    • cached

      boolean cached
      Default:
      true
    • cachingDepth

      int cachingDepth
      Setting to control how many versions of the aggregate will be stored in the cache. I.e. how many times Entity.previous() can be invoked on the aggregate before event sourcing is necessary.

      Note that loading an aggregate inside an event handler will automatically play back the aggregate to the moment of the event. I.e. even if your code does not invoke Entity.previous() anywhere, this setting will still be relevant.

      A negative depth (the default) implies that every version of the aggregate will be cached. For event sourced aggregates that can become quite large (events in the 100s or more) it is therefore advisable to specify a depth. Note that a depth of 0 only caches the most recent version of the aggregate.

      This setting does nothing if cached() or eventSourced() is false.

      Default:
      -1
    • checkpointPeriod

      int checkpointPeriod
      Setting to control after which number of applied events the state of an aggregate should be stored in the cache to serve as checkpoint for event sourcing when requesting later version of the aggregate.

      Note that this setting only applies for older versions of the aggregate, i.e. for sequence numbers smaller than or equal to the most recent sequence number minus the cachingDepth().

      This period should be greater than or equal to 1. For a period of 1 all versions of the aggregate will be cached, which can also be achieved by selecting a negative cachingDepth() (the default).

      This setting does nothing if cached() or eventSourced() is false.

      Default:
      100
    • commitInBatch

      boolean commitInBatch
      Default:
      true
    • eventPublication

      EventPublication eventPublication
      Setting to control event publication.

      Use @Aggregate(eventPublication = IF_MODIFIED) to stop events from being published if the aggregate does not change, removing the need for dedicated InterceptApply methods for this.

      Use @Aggregate(eventPublication = NEVER) to prevent event publication altogether. This is useful because it allows command application on aggregates with eventSourcing = false without giving rise to events.

      Default:
      ALWAYS
    • publicationStrategy

      EventPublicationStrategy publicationStrategy
      Setting that determines what happens to published events. Note that eventPublication() is checked first to determine if an applied event should be published at all. Only then is checked how the events are to be published given the strategy.
      Default:
      STORE_AND_PUBLISH
    • searchable

      boolean searchable
      Default:
      false
    • collection

      String collection
      Default:
      ""
    • timestampPath

      String timestampPath
      Default:
      ""