T - The type of the aggregate root objectpublic class EventSourcedAggregate<T>
extends org.axonframework.modelling.command.inspection.AnnotatedAggregate<T>
Aggregate that is sourced from events that have
been published by the aggregate.| Modifier | Constructor and Description |
|---|---|
protected |
EventSourcedAggregate(org.axonframework.modelling.command.inspection.AggregateModel<T> model,
org.axonframework.eventhandling.EventBus eventBus,
org.axonframework.modelling.command.RepositoryProvider repositoryProvider,
SnapshotTrigger snapshotTrigger)
Creates a new EventSourcedAggregate instance based on the given
model, which publishes events to the
given eventBus. |
protected |
EventSourcedAggregate(org.axonframework.modelling.command.inspection.AggregateModel<T> model,
org.axonframework.eventhandling.EventBus eventBus,
SnapshotTrigger snapshotTrigger)
Creates a new EventSourcedAggregate instance based on the given
model, which publishes events to the
given eventBus. |
protected |
EventSourcedAggregate(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> model,
org.axonframework.eventhandling.EventBus eventBus,
org.axonframework.modelling.command.RepositoryProvider repositoryProvider,
SnapshotTrigger snapshotTrigger)
Initializes an Aggregate instance for the given
aggregateRoot, based on the given model, which
publishes events to the given eventBus. |
protected |
EventSourcedAggregate(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> model,
org.axonframework.eventhandling.EventBus eventBus,
SnapshotTrigger snapshotTrigger)
Initializes an Aggregate instance for the given
aggregateRoot, based on the given model, which
publishes events to the given eventBus. |
| Modifier and Type | Method and Description |
|---|---|
<P> org.axonframework.modelling.command.ApplyMore |
doApply(P payload,
org.axonframework.messaging.MetaData metaData) |
protected boolean |
getIsLive() |
SnapshotTrigger |
getSnapshotTrigger()
The trigger instance that monitors this aggregate to trigger a snapshot
|
static <T> EventSourcedAggregate<T> |
initialize(Callable<T> aggregateFactory,
org.axonframework.modelling.command.inspection.AggregateModel<T> inspector,
org.axonframework.eventhandling.EventBus eventBus,
org.axonframework.modelling.command.RepositoryProvider repositoryProvider,
SnapshotTrigger snapshotTrigger)
Initializes an EventSourcedAggregate instance using the given
aggregateFactory, based on the given inspector, which publishes events to the given eventBus and stores events in the given eventStore. |
static <T> EventSourcedAggregate<T> |
initialize(Callable<T> aggregateFactory,
org.axonframework.modelling.command.inspection.AggregateModel<T> inspector,
org.axonframework.eventhandling.EventBus eventBus,
SnapshotTrigger snapshotTrigger)
Initializes an EventSourcedAggregate instance using the given
aggregateFactory, based on the given inspector, which publishes events to the given eventBus and stores events in the given eventStore. |
static <T> EventSourcedAggregate<T> |
initialize(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> inspector,
org.axonframework.eventhandling.EventBus eventBus,
org.axonframework.modelling.command.RepositoryProvider repositoryProvider,
SnapshotTrigger snapshotTrigger)
Initializes an EventSourcedAggregate instance for the given
aggregateRoot, based on the given inspector, which publishes events to the given eventBus. |
static <T> EventSourcedAggregate<T> |
initialize(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> inspector,
org.axonframework.eventhandling.EventBus eventBus,
SnapshotTrigger snapshotTrigger)
Initializes an EventSourcedAggregate instance for the given
aggregateRoot, based on the given inspector, which publishes events to the given eventBus. |
void |
initializeState(DomainEventStream eventStream)
Initialize the state of this Event Sourced Aggregate with the events from the given
eventStream. |
protected void |
publish(org.axonframework.eventhandling.EventMessage<?> msg) |
protected void |
publishOnEventBus(org.axonframework.eventhandling.EventMessage<?> msg) |
static <T> EventSourcedAggregate<T> |
reconstruct(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> model,
long seqNo,
boolean isDeleted,
org.axonframework.eventhandling.EventBus eventBus,
org.axonframework.modelling.command.RepositoryProvider repositoryProvider,
SnapshotTrigger snapshotTrigger)
Reconstructs an EventSourcedAggregate instance with given
aggregateRoot. |
static <T> EventSourcedAggregate<T> |
reconstruct(T aggregateRoot,
org.axonframework.modelling.command.inspection.AggregateModel<T> model,
long seqNo,
boolean isDeleted,
org.axonframework.eventhandling.EventBus eventBus,
SnapshotTrigger snapshotTrigger)
Reconstructs an EventSourcedAggregate instance with given
aggregateRoot. |
Long |
version() |
andThen, andThenApply, applyMessageOrPayload, createMessage, doCreateNew, doMarkDeleted, execute, getAggregateRoot, handle, identifier, initialize, initialize, initialize, initialize, initialize, initialize, initSequence, initSequence, invoke, isDeleted, lastSequence, registerRoot, rootType, typeapply, apply, createNew, describeScope, execute, getInstance, getVersion, isLive, markDeleteddescribeCurrentScope, endScope, executeWithResult, getCurrentScope, startScopeprotected EventSourcedAggregate(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> model, org.axonframework.eventhandling.EventBus eventBus, SnapshotTrigger snapshotTrigger)
aggregateRoot, based on the given model, which
publishes events to the given eventBus.aggregateRoot - The aggregate root instancemodel - The model describing the aggregate structureeventBus - The event store to store generated events insnapshotTrigger - The trigger to notify of events and initializationprotected EventSourcedAggregate(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> model, org.axonframework.eventhandling.EventBus eventBus, org.axonframework.modelling.command.RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger)
aggregateRoot, based on the given model, which
publishes events to the given eventBus.aggregateRoot - The aggregate root instancemodel - The model describing the aggregate structureeventBus - The event store to store generated events inrepositoryProvider - Provides repositories for specific aggregate typessnapshotTrigger - The trigger to notify of events and initializationprotected EventSourcedAggregate(org.axonframework.modelling.command.inspection.AggregateModel<T> model, org.axonframework.eventhandling.EventBus eventBus, SnapshotTrigger snapshotTrigger)
model, which publishes events to the
given eventBus. This aggregate is not assigned a root instance yet.model - The model describing the aggregate structureeventBus - The event store to store generated events insnapshotTrigger - The trigger to notify of events and initializationAnnotatedAggregate.registerRoot(Callable)protected EventSourcedAggregate(org.axonframework.modelling.command.inspection.AggregateModel<T> model, org.axonframework.eventhandling.EventBus eventBus, org.axonframework.modelling.command.RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger)
model, which publishes events to the
given eventBus. This aggregate is not assigned a root instance yet.model - The model describing the aggregate structureeventBus - The event store to store generated events inrepositoryProvider - Provides repositories for specific aggregate typessnapshotTrigger - The trigger to notify of events and initializationAnnotatedAggregate.registerRoot(Callable)public static <T> EventSourcedAggregate<T> initialize(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> inspector, org.axonframework.eventhandling.EventBus eventBus, SnapshotTrigger snapshotTrigger)
aggregateRoot, based on the given inspector, which publishes events to the given eventBus.T - the aggregate root typeaggregateRoot - The aggregate root instanceinspector - The inspector describing the aggregate structureeventBus - The event bus to send generated events tosnapshotTrigger - The trigger to notify of events and initializationpublic static <T> EventSourcedAggregate<T> initialize(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> inspector, org.axonframework.eventhandling.EventBus eventBus, org.axonframework.modelling.command.RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger)
aggregateRoot, based on the given inspector, which publishes events to the given eventBus.T - the aggregate root typeaggregateRoot - The aggregate root instanceinspector - The inspector describing the aggregate structureeventBus - The event bus to send generated events torepositoryProvider - Provides repositories for specific aggregate typessnapshotTrigger - The trigger to notify of events and initializationpublic static <T> EventSourcedAggregate<T> initialize(Callable<T> aggregateFactory, org.axonframework.modelling.command.inspection.AggregateModel<T> inspector, org.axonframework.eventhandling.EventBus eventBus, SnapshotTrigger snapshotTrigger) throws Exception
aggregateFactory, based on the given inspector, which publishes events to the given eventBus and stores events in the given eventStore.T - the aggregate root typeaggregateFactory - The aggregate root factoryinspector - The inspector describing the aggregate structureeventBus - The event bus to send generated events tosnapshotTrigger - The trigger to notify of events and initializationException - if the aggregate cannot be initializedpublic static <T> EventSourcedAggregate<T> initialize(Callable<T> aggregateFactory, org.axonframework.modelling.command.inspection.AggregateModel<T> inspector, org.axonframework.eventhandling.EventBus eventBus, org.axonframework.modelling.command.RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger) throws Exception
aggregateFactory, based on the given inspector, which publishes events to the given eventBus and stores events in the given eventStore.T - the aggregate root typeaggregateFactory - The aggregate root factoryinspector - The inspector describing the aggregate structureeventBus - The event bus to send generated events torepositoryProvider - Provides repositories for specific aggregate typessnapshotTrigger - The trigger to notify of events and initializationException - if the aggregate cannot be initializedpublic static <T> EventSourcedAggregate<T> reconstruct(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> model, long seqNo, boolean isDeleted, org.axonframework.eventhandling.EventBus eventBus, SnapshotTrigger snapshotTrigger)
aggregateRoot. The aggregate's sequence number
should be set to the given seqNo and its deleted flag to the given isDeleted.
Use this method to initialize an EventSourcedAggregate without having to replay the aggregate from events.
T - the aggregate root typeaggregateRoot - The aggregate root instancemodel - The model describing the aggregate structureseqNo - The last event sequence number of the aggregateisDeleted - Flag to indicate whether or not the aggregate is deletedeventBus - The event bus to send generated events tosnapshotTrigger - The trigger to notify of events and initializationpublic static <T> EventSourcedAggregate<T> reconstruct(T aggregateRoot, org.axonframework.modelling.command.inspection.AggregateModel<T> model, long seqNo, boolean isDeleted, org.axonframework.eventhandling.EventBus eventBus, org.axonframework.modelling.command.RepositoryProvider repositoryProvider, SnapshotTrigger snapshotTrigger)
aggregateRoot. The aggregate's sequence number
should be set to the given seqNo and its deleted flag to the given isDeleted.
Use this method to initialize an EventSourcedAggregate without having to replay the aggregate from events.
T - the aggregate root typeaggregateRoot - The aggregate root instancemodel - The model describing the aggregate structureseqNo - The last event sequence number of the aggregateisDeleted - Flag to indicate whether or not the aggregate is deletedeventBus - The event bus to send generated events torepositoryProvider - Provides repositories for specific aggregate typessnapshotTrigger - The trigger to notify of events and initializationpublic <P> org.axonframework.modelling.command.ApplyMore doApply(P payload,
org.axonframework.messaging.MetaData metaData)
doApply in class org.axonframework.modelling.command.inspection.AnnotatedAggregate<T>protected void publish(org.axonframework.eventhandling.EventMessage<?> msg)
publish in class org.axonframework.modelling.command.inspection.AnnotatedAggregate<T>protected void publishOnEventBus(org.axonframework.eventhandling.EventMessage<?> msg)
publishOnEventBus in class org.axonframework.modelling.command.inspection.AnnotatedAggregate<T>public Long version()
public void initializeState(DomainEventStream eventStream)
eventStream.eventStream - The Event Stream containing the events to be used to reconstruct this Aggregate's state.protected boolean getIsLive()
getIsLive in class org.axonframework.modelling.command.inspection.AnnotatedAggregate<T>public SnapshotTrigger getSnapshotTrigger()
Copyright © 2010–2024. All rights reserved.