public class SagaMethodMessageHandler extends Object implements Comparable<SagaMethodMessageHandler>
SagaEventHandler
annotated methods.Modifier | Constructor and Description |
---|---|
protected |
SagaMethodMessageHandler(SagaCreationPolicy creationPolicy,
MethodMessageHandler handler,
String associationKey,
Property associationProperty)
Creates a SagaMethodMessageHandler.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(SagaMethodMessageHandler o) |
boolean |
equals(Object o) |
AssociationValue |
getAssociationValue(EventMessage eventMessage)
The AssociationValue to find the saga instance with, or
null if no AssociationValue can be found on
the given eventMessage . |
SagaCreationPolicy |
getCreationPolicy()
Returns the creation policy of the inspected method.
|
static SagaMethodMessageHandler |
getInstance(MethodMessageHandler methodHandler)
Create a SagaMethodMessageHandler for the given
methodHandler . |
String |
getName()
Returns the name of the handler.
|
int |
hashCode() |
void |
invoke(Object target,
EventMessage message)
Invoke a handler on given
target for given message . |
boolean |
isEndingHandler()
Indicates whether this handler is one that ends the Saga lifecycle
|
boolean |
isHandlerAvailable()
Indicates whether the inspected method is an Event Handler.
|
boolean |
matches(EventMessage message)
Indicates whether this Handler is suitable for the given
message . |
static SagaMethodMessageHandler |
noHandler()
Returns a SagaMethodMessageHandler indicating that a inspected method is *not* a SagaEventHandler.
|
protected SagaMethodMessageHandler(SagaCreationPolicy creationPolicy, MethodMessageHandler handler, String associationKey, Property associationProperty)
creationPolicy
- The creation policy for the handlerMethodhandler
- The handler for the eventassociationKey
- The association key configured for this handlerassociationProperty
- The association property configured for this handlerpublic static SagaMethodMessageHandler noHandler()
public static SagaMethodMessageHandler getInstance(MethodMessageHandler methodHandler)
methodHandler
. The SagaMethodMessageHandler add
information specific to the behavior of Sagas, such as the association value and creation policy.methodHandler
- The handler for incoming eventspublic boolean isHandlerAvailable()
public AssociationValue getAssociationValue(EventMessage eventMessage)
null
if no AssociationValue can be found on
the given eventMessage
.eventMessage
- The event message containing the value of the associationnull
if none foundpublic SagaCreationPolicy getCreationPolicy()
public boolean matches(EventMessage message)
message
.message
- The message to inspecttrue
if this handler can handle the message, otherwise false
.public boolean isEndingHandler()
true
if the Saga lifecycle ends unconditionally after this call, otherwise
false
public int compareTo(SagaMethodMessageHandler o)
compareTo
in interface Comparable<SagaMethodMessageHandler>
public void invoke(Object target, EventMessage message)
target
for given message
.target
- The instance to invoke a method onmessage
- The message to use to resolve the parameters of the handler to invokepublic String getName()
Copyright © 2010-2014. All Rights Reserved.