public static class SimpleEventHandlerInvoker.Builder extends Object
SimpleEventHandlerInvoker.
The ListenerInvocationErrorHandler is defaulted to a LoggingErrorHandler and the
SequencingPolicy to a SequentialPerAggregatePolicy. Providing at least one Event Handler is a
hard requirement and thus should be accounted for.
| Constructor and Description |
|---|
Builder() |
public SimpleEventHandlerInvoker.Builder eventHandlers(Object... eventHandlers)
eventHandlers this EventHandlerInvoker will forward all its events to. If an event
handler is assignable to EventMessageHandler it will registered as is. If not, it will be wrapped by
a new AnnotationEventHandlerAdapter.eventHandlers - an array of Objects which can handle eventspublic SimpleEventHandlerInvoker.Builder eventHandlers(List<?> eventHandlers)
eventHandlers this EventHandlerInvoker will forward all its events to. If an event
handler is assignable to EventMessageHandler it will registered as is. If not, it will be wrapped by
a new AnnotationEventHandlerAdapter.public SimpleEventHandlerInvoker.Builder parameterResolverFactory(ParameterResolverFactory parameterResolverFactory)
ParameterResolverFactory used to resolve parameter values for annotated handlers in the
AnnotationEventHandlerAdapter this EventHandlerInvoker instantiates. This invoker will only
instantiate a new EventMessageHandler if a given Event Handler (through
eventHandlers(Object...) or eventHandlers(List)) is not assignable to EventMessageHandler.parameterResolverFactory - the ParameterResolverFactory used to resolve parameter values for
instantiated AnnotationEventHandlerAdapterspublic SimpleEventHandlerInvoker.Builder handlerDefinition(HandlerDefinition handlerDefinition)
HandlerDefinition used to create concrete handlers in the annotated handlers in the
AnnotationEventHandlerAdapter this EventHandlerInvoker instantiates. This invoker will only
instantiate a new EventMessageHandler if a given Event Handler
(through eventHandlers(Object...) or eventHandlers(List)) is not assignable to
EventMessageHandler.handlerDefinition - the HandlerDefinition used to create concrete handlers in the instantiated
AnnotationEventHandlerAdapterspublic SimpleEventHandlerInvoker.Builder listenerInvocationErrorHandler(ListenerInvocationErrorHandler listenerInvocationErrorHandler)
ListenerInvocationErrorHandler which deals with any Exceptions being thrown by the
EventListeners. Defaults to a LoggingErrorHandler.listenerInvocationErrorHandler - a ListenerInvocationErrorHandler which deals with any Exceptions being thrown by the EventListenerspublic SimpleEventHandlerInvoker.Builder sequencingPolicy(SequencingPolicy<? super EventMessage<?>> sequencingPolicy)
SequencingPolicy in charge of deciding whether a given event should be handled (through
SimpleEventHandlerInvoker.handle(EventMessage, Segment)) by the given Segment. Used when this
EventHandlerInvoker is invoked for multiple Segments (i.e. using parallel processing). Defaults to a
SequentialPerAggregatePolicy,sequencingPolicy - a SequencingPolicy in charge of deciding whether a given event should be
handled by the given Segmentpublic SimpleEventHandlerInvoker build()
SimpleEventHandlerInvoker as specified through this Builder.SimpleEventHandlerInvoker as specified through this Builderpublic AnnotationEventHandlerAdapter wrapEventMessageHandler(Object eventHandler)
eventHandler in an AnnotationEventHandlerAdapter to allow this
EventHandlerInvoker to correctly pass EventMessages to it. If a
ParameterResolverFactory or both a ParameterResolverFactory and HandlerDefinition are
present, one/both will be given to the AnnotationEventHandlerAdaptereventHandler - an Object which will be wrapped in an AnnotationEventHandlerAdapterAnnotationEventHandlerAdapter which the given eventHandler will be wrapped inprotected void validate()
throws AxonConfigurationException
AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2018. All rights reserved.