public class AnnotatedSaga<T> extends SagaLifecycle implements Saga<T>
interface that allows for a POJO instance with annotated message handlers to act
 as a Saga. The POJO instance can access static methods on SagaLifecycle as long as it is access via the
 execute(Consumer) or invoke(Function) methods.| Constructor and Description | 
|---|
AnnotatedSaga(String sagaId,
             Set<AssociationValue> associationValues,
             T annotatedSaga,
             TrackingToken trackingToken,
             SagaModel<T> metaModel)
Creates an AnnotatedSaga instance to wrap the given  
annotatedSaga, identifier with the given
 sagaId and associated with the given associationValues. | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
canHandle(EventMessage<?> event)
Indicates whether this listener can handle the given event message 
 | 
protected void | 
doAssociateWith(AssociationValue property)
Registers a AssociationValue with the given saga. 
 | 
protected void | 
doEnd()
Marks the saga as ended. 
 | 
protected void | 
doRemoveAssociation(AssociationValue property)
Removes the given association from this Saga. 
 | 
void | 
execute(Consumer<T> invocation)
Execute the given  
invocation against the root object of this Saga instance. | 
AssociationValues | 
getAssociationValues()
Returns a view on the Association Values for this saga instance. 
 | 
String | 
getSagaIdentifier()
Returns the unique identifier of this saga. 
 | 
void | 
handle(EventMessage<?> event)
Process the given event. 
 | 
<R> R | 
invoke(Function<T,R> invocation)
Execute the given  
invocation against the root object of this Saga instance. | 
boolean | 
isActive()
Indicates whether or not this saga is active. 
 | 
T | 
root()
Returns the (annotated) Saga instance. 
 | 
TrackingToken | 
trackingToken()
Returns the TrackingToken belonging to the EventMessage last processed by this instance, or  
null if
 this instance never handled an EventMessage, or if it received an EventMessage that doesn't carry a
 TrackingToken. | 
associateWith, associateWith, associateWith, end, execute, executeWithResult, getInstance, removeAssociationWith, removeAssociationWithclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprepareReset, supportsResetpublic AnnotatedSaga(String sagaId, Set<AssociationValue> associationValues, T annotatedSaga, TrackingToken trackingToken, SagaModel<T> metaModel)
annotatedSaga, identifier with the given
 sagaId and associated with the given associationValues. The metaModel provides the
 description of the structure of the Saga.sagaId - The identifier of this Saga instanceassociationValues - The current associations of this SagaannotatedSaga - The object instance representing the SagatrackingToken - The token identifying the position in a stream the saga has last processedmetaModel - The model describing Saga structurepublic String getSagaIdentifier()
SagagetSagaIdentifier in interface Saga<T>public AssociationValues getAssociationValues()
SagagetAssociationValues in interface Saga<T>public <R> R invoke(Function<T,R> invocation)
Sagainvocation against the root object of this Saga instance.public void execute(Consumer<T> invocation)
Sagainvocation against the root object of this Saga instance.public final boolean canHandle(EventMessage<?> event)
EventListenercanHandle in interface EventListenerevent - The event message to verifytrue if this listener can handle the event, otherwise falsepublic final void handle(EventMessage<?> event)
EventListenerhandle in interface EventListenerevent - the event to handlepublic boolean isActive()
Sagapublic TrackingToken trackingToken()
Saganull if
 this instance never handled an EventMessage, or if it received an EventMessage that doesn't carry a
 TrackingToken.trackingToken in interface Saga<T>public T root()
SagaLifecycle.protected void doEnd()
doEnd in class SagaLifecycleprotected void doAssociateWith(AssociationValue property)
doAssociateWith in class SagaLifecycleproperty - The value to associate this saga with.protected void doRemoveAssociation(AssociationValue property)
doRemoveAssociation in class SagaLifecycleproperty - the association value to remove from the saga.Copyright © 2010–2018. All rights reserved.