Class ChainedMessageHandlerInterceptorMember<T>
java.lang.Object
org.axonframework.messaging.core.annotation.ChainedMessageHandlerInterceptorMember<T>
- Type Parameters:
T- The type that declares the handlers in this chain.
- All Implemented Interfaces:
MessageHandlerInterceptorMemberChain<T>
public class ChainedMessageHandlerInterceptorMember<T>
extends Object
implements MessageHandlerInterceptorMemberChain<T>
A
MessageHandlerInterceptorMemberChain implementation that constructs a chain of instances of itself based on
a given iterator of MessageHandlingMembers.- Since:
- 4.4.0
- Author:
- Allard Buijze
-
Constructor Summary
ConstructorsConstructorDescriptionChainedMessageHandlerInterceptorMember(Class<?> handlerType, Iterator<MessageHandlingMember<? super T>> iterator) Constructs a chained message handling interceptor for the givenhandlerType, constructing a chain from the giveniterator. -
Method Summary
Modifier and TypeMethodDescriptionhandle(Message message, ProcessingContext context, T target, MessageHandlingMember<? super T> handler) handleSync(Message message, ProcessingContext context, T target, MessageHandlingMember<? super T> handler) Handle the givenmessageby passing it through the interceptors and ultimately to the givenhandleron the giventargetinstance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.messaging.core.interception.annotation.MessageHandlerInterceptorMemberChain
handleSync
-
Constructor Details
-
ChainedMessageHandlerInterceptorMember
public ChainedMessageHandlerInterceptorMember(Class<?> handlerType, Iterator<MessageHandlingMember<? super T>> iterator) Constructs a chained message handling interceptor for the givenhandlerType, constructing a chain from the giveniterator.The
iteratorshould at least> have a singleMessageHandlingMember. If there are moreMessageHandlingMemberspresent in the giveniterator, this constructor will be invoked again.- Parameters:
handlerType- The type for which to construct a message handler interceptor chain.iterator- TheMessageHandlingMembersfrom which to construct the chain.
-
-
Method Details
-
handle
public MessageStream<?> handle(@Nonnull Message message, @Nonnull ProcessingContext context, @Nonnull T target, @Nonnull MessageHandlingMember<? super T> handler) - Specified by:
handlein interfaceMessageHandlerInterceptorMemberChain<T>
-
handleSync
public Object handleSync(@Nonnull Message message, @Nonnull ProcessingContext context, @Nonnull T target, @Nonnull MessageHandlingMember<? super T> handler) throws Exception Description copied from interface:MessageHandlerInterceptorMemberChainHandle the givenmessageby passing it through the interceptors and ultimately to the givenhandleron the giventargetinstance. The result of this invocation is the result as given by thehandler, possibly modified by any of the interceptors in this chain.- Specified by:
handleSyncin interfaceMessageHandlerInterceptorMemberChain<T>- Parameters:
message- The message to pass through the interceptor chain.context- The context in which the message is being handled.target- The target instance to invoke the interceptors and handlers on.handler- The actual handler to invoke once all interceptors have received the message.- Returns:
- The result as returned by the handlers or interceptors.
- Throws:
Exception- Any exception thrown by the handler or any of the interceptors.
-