Interface CommandBusInterceptorChain
-
- All Known Implementing Classes:
CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
public interface CommandBusInterceptorChainGeneric interceptor chain concept that supports interceptingLocalCommandBusoperations
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classCommandBusInterceptorChain.DefaultCommandBusInterceptorChainDefault implementation for theCommandBusInterceptorChain.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Objectcommand()The command associated with the interceptor chainCommandHandlermatchedCommandHandler()The singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)static CommandBusInterceptorChainnewInterceptorChain(Object command, CommandHandler matchedCommandHandler, List<CommandBusInterceptor> interceptors, BiFunction<CommandBusInterceptor,CommandBusInterceptorChain,Object> interceptorOperationInvoker, Function<Object,Object> defaultCommandBusBehaviour)Create a newCommandBusInterceptorChaininstance for the handling of a CommandObjectproceed()To continue the processing aCommandBusInterceptorwill call this method, which in turn will call otherCommandBusInterceptor's (if more interceptors are configured) and finally theLocalCommandBus's default implementation will be called.
If theCommandBusInterceptorcan provide a result without calling the defaultLocalCommandBusbehaviour then it can just return its (e.g.
-
-
-
Method Detail
-
proceed
Object proceed()
To continue the processing aCommandBusInterceptorwill call this method, which in turn will call otherCommandBusInterceptor's (if more interceptors are configured) and finally theLocalCommandBus's default implementation will be called.
If theCommandBusInterceptorcan provide a result without calling the defaultLocalCommandBusbehaviour then it can just return its (e.g. cached) result and not callproceed()- Returns:
- the result of the operation
-
command
Object command()
The command associated with the interceptor chain- Returns:
- The command associated with the interceptor chain
-
matchedCommandHandler
CommandHandler matchedCommandHandler()
The singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)- Returns:
- the matched command handler
-
newInterceptorChain
static CommandBusInterceptorChain newInterceptorChain(Object command, CommandHandler matchedCommandHandler, List<CommandBusInterceptor> interceptors, BiFunction<CommandBusInterceptor,CommandBusInterceptorChain,Object> interceptorOperationInvoker, Function<Object,Object> defaultCommandBusBehaviour)
Create a newCommandBusInterceptorChaininstance for the handling of a Command- Parameters:
command- the command instancematchedCommandHandler- the singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)interceptors- theCommandBusInterceptor's (can be an empty List if no interceptors have been configured)interceptorOperationInvoker- the function responsible for calling the correctCommandBusInterceptorsendmethoddefaultCommandBusBehaviour- the function invoking the defaultLocalCommandBussendmethod logic- Returns:
- a new
CommandBusInterceptorChaininstance
-
-