Interface CommandBusInterceptorChain
- All Known Implementing Classes:
CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
public interface CommandBusInterceptorChain
Generic interceptor chain concept that supports intercepting
LocalCommandBus operations-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classDefault implementation for theCommandBusInterceptorChain. -
Method Summary
Modifier and TypeMethodDescriptioncommand()The command associated with the interceptor chainThe 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 Commandproceed()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 Details
-
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
-