All Classes
-
All Classes Interface Summary Class Summary Exception Summary Annotation Types Summary Class Description AbstractCommandBus Base implementation of theCommandBus- provides default implementation for all operations except forCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)AnnotatedCommandHandler Extending this class will allow you to colocate multiple related Command handling methods inside the same class and use it together with theLocalCommandBus
Each method must accept a single Command argument, may return a value or return void and be annotated with either theHandlerorCmdHandlerannotation.
The method argument type is matched against the concrete command type usingClass.isAssignableFrom(Class).
The method accessibility can be any combination of private, protected, public, etc.
Example:AnnotatedEventHandler Extending this class will allow you to colocate multiple related Event handling methods inside the same class and use it together with theLocalEventBus
Each method must accept a single Event argument, return void and be annotated with theHandlerannotation.
The method argument type is matched against the concrete event type usingClass.isAssignableFrom(Class).
The method accessibility can be any combination of private, protected, public, etc.
Example:AsyncEventHandler Annotate anEventHandler/AnnotatedEventHandlerwith this annotation to have theEventHandlerbe registered as an asynchronous event-handler with the defaultLocalEventBus(default is registering them as a synchronous event handler).CmdHandler AnnotatedCommandHandlerspecific method annotation, that can be used instead ofHandler, that can be applied to any single argument method inside aAnnotatedCommandHandler
The annotated methods can have the following accessibility: private, protected, public, etc.CommandBus TheCommandBusprovides an indirection between a command and theCommandHandlerthat's capable of handling the command.
Commands can be sent synchronously usingCommandBus.send(Object)or asynchronously usingCommandBus.sendAsync(Object)that returns aMono.
The handling of a command usually doesn't return any value (according to the principles of CQRS), however theLocalCommandBusAPI allows aCommandHandlerto return a value if needed (e.g.CommandBusInterceptor AnCommandBusInterceptorallows you to intercept Commands before and after they're being handled by theLocalCommandBusCommandBusInterceptorChain Generic interceptor chain concept that supports interceptingLocalCommandBusoperationsCommandBusInterceptorChain.DefaultCommandBusInterceptorChain Default implementation for theCommandBusInterceptorChain.CommandHandler Common interface for all Command message handlers
A command handler can choose support to 1 or more command typesEventBus Simple event bus concept that supports both synchronous and asynchronous subscribers that are registered and listening for events published
Usage example:EventHandler Common interface for all Event message handlersHandler Generic Method annotation that can be applied to any single argument method inside aAnnotatedCommandHandlerorAnnotatedEventHandler.
Depending on which class you extend the rules that apply to each method may be different.
Common for all is that the method accessibility can be any combination of private, protected, public, etc.LocalCommandBus Provides a JVM local and non-durable, in regard toLocalCommandBus.sendAndDontWait(Object)/LocalCommandBus.sendAndDontWait(Object, Duration)), variant of theCommandBusconceptLocalEventBus Simple event bus that supports both synchronous and asynchronous subscribers that are registered and listening for events published within the local the JVM
You can have multiple instances of the LocalEventBus deployed with the local JVM, but usually one event bus is sufficient.
Example:MultipleCommandHandlersFoundException NoCommandHandlerFoundException OnErrorHandler Error Handler interface for theLocalEventBus's asynchronous event handler failuresPublishException ReactiveHandlersBeanPostProcessor When using Spring or Spring Boot it will be easier to register theEventBus,CommandBus,CommandHandlerandEventHandlerinstances as @Bean or @Component and automatically have theCommandHandlerbeans registered as with the singleCommandBusbean and theEventHandlerbeans registered as subscribers with one or moreEventBusbeans.SendAndDontWaitErrorHandler Exception handler that will handle errors that occur duringCommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)SendAndDontWaitErrorHandler.FallbackSendAndDontWaitErrorHandler FallbackSendAndDontWaitErrorHandlerthat only error logs any issues.
Note: If theSendAndDontWaitErrorHandler.FallbackSendAndDontWaitErrorHandleris used with a Durable Command Bus (e.g.SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler FallbackSendAndDontWaitErrorHandlerthat error logs any issues and rethrows the exception.
TheSendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandleris compatible with a Durable Command Bus (e.g.SendCommandException