Class CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
java.lang.Object
dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
- All Implemented Interfaces:
CommandBusInterceptorChain
- Enclosing interface:
- CommandBusInterceptorChain
public static class CommandBusInterceptorChain.DefaultCommandBusInterceptorChain
extends Object
implements CommandBusInterceptorChain
Default implementation for the
CommandBusInterceptorChain. It's recommended to use CommandBusInterceptorChain.newInterceptorChain(Object, CommandHandler, List, BiFunction, Function)
to create a new chain-
Nested Class Summary
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.reactive.command.interceptor.CommandBusInterceptorChain
CommandBusInterceptorChain.DefaultCommandBusInterceptorChain -
Constructor Summary
ConstructorsConstructorDescriptionDefaultCommandBusInterceptorChain(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 -
Method Summary
Modifier and TypeMethodDescriptioncommand()The command associated with the interceptor chainThe singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)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 callCommandBusInterceptorChain.proceed()
-
Constructor Details
-
DefaultCommandBusInterceptorChain
public DefaultCommandBusInterceptorChain(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- the orderedCommandBusInterceptor'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
-
-
Method Details
-
proceed
Description copied from interface:CommandBusInterceptorChainTo 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 callCommandBusInterceptorChain.proceed()- Specified by:
proceedin interfaceCommandBusInterceptorChain- Returns:
- the result of the operation
-
command
Description copied from interface:CommandBusInterceptorChainThe command associated with the interceptor chain- Specified by:
commandin interfaceCommandBusInterceptorChain- Returns:
- The command associated with the interceptor chain
-
matchedCommandHandler
Description copied from interface:CommandBusInterceptorChainThe singleCommandHandlerthe responded true toCommandHandler.canHandle(Class)- Specified by:
matchedCommandHandlerin interfaceCommandBusInterceptorChain- Returns:
- the matched command handler
-