All Classes and Interfaces
Class
Description
Base implementation of the
CommandBus - provides default implementation for all
operations except for CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)Extending this class will allow you to colocate multiple related Command handling methods inside the same class and use it together with the
Each method must accept a single Command argument, may return a value or return void and be annotated with either the
The method argument type is matched against the concrete command type using
The method accessibility can be any combination of private, protected, public, etc.
Example:
LocalCommandBusEach method must accept a single Command argument, may return a value or return void and be annotated with either the
Handler or CmdHandler annotation.The method argument type is matched against the concrete command type using
Class.isAssignableFrom(Class).The method accessibility can be any combination of private, protected, public, etc.
Example:
Extending this class will allow you to colocate multiple related Event handling methods inside the same class and use it together with the
Each method must accept a single Event argument, return void and be annotated with the
The method argument type is matched against the concrete event type using
The method accessibility can be any combination of private, protected, public, etc.
Example:
LocalEventBusEach method must accept a single Event argument, return void and be annotated with the
Handler annotation.The method argument type is matched against the concrete event type using
Class.isAssignableFrom(Class).The method accessibility can be any combination of private, protected, public, etc.
Example:
Annotate an
EventHandler/AnnotatedEventHandler with this annotation
to have the EventHandler be registered as an asynchronous event-handler with the default LocalEventBus (default is registering them as a synchronous event handler).AnnotatedCommandHandler specific method annotation, that can be used instead of Handler,
that can be applied to any single argument method inside a AnnotatedCommandHandlerThe annotated methods can have the following accessibility: private, protected, public, etc.
The
Commands can be sent synchronously using
The handling of a command usually doesn't return any value (according to the principles of CQRS), however the
One important rule is that there can only be one
If multiple
If no
CommandBus provides an indirection between a command and the CommandHandler that's capable of handling the command.Commands can be sent synchronously using
CommandBus.send(Object) or asynchronously using CommandBus.sendAsync(Object) that returns a Mono.The handling of a command usually doesn't return any value (according to the principles of CQRS), however the
LocalCommandBus API allows
a CommandHandler to return a value if needed (e.g. such as a server generated id)One important rule is that there can only be one
CommandHandler instance that can handle any given command type.If multiple
CommandHandler claim that they all can handle a given command type then CommandBus.send(Object)/CommandBus.sendAsync(Object) will throw MultipleCommandHandlersFoundExceptionIf no
CommandHandler's can handle the given command type then CommandBus.send(Object)/CommandBus.sendAsync(Object) will throw NoCommandHandlerFoundExceptionAn
CommandBusInterceptor allows you to intercept Commands before and after they're being handled by the LocalCommandBusGeneric interceptor chain concept that supports intercepting
LocalCommandBus operationsDefault implementation for the
CommandBusInterceptorChain.Common interface for all Command message handlers
A command handler can choose support to 1 or more command types
A command handler can choose support to 1 or more command types
Simple event bus concept that supports both synchronous and asynchronous subscribers that are registered and listening for events published
Usage example:
Usage example:
Common interface for all Event message handlers
Generic Method annotation that can be applied to any single argument method inside a
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.
AnnotatedCommandHandler or AnnotatedEventHandler.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.
Provides a JVM local and non-durable,
in regard to
LocalCommandBus.sendAndDontWait(Object)/LocalCommandBus.sendAndDontWait(Object, Duration)),
variant of the CommandBus conceptSimple 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:
You can have multiple instances of the LocalEventBus deployed with the local JVM, but usually one event bus is sufficient.
Example:
Builder class for
LocalEventBus.Error Handler interface for the
LocalEventBus's asynchronous
event handler failuresWhen using Spring or Spring Boot it will be easier to register the
EventBus, CommandBus, CommandHandler and EventHandler instances as @Bean or @Component
and automatically have the CommandHandler beans registered as with the single CommandBus bean and the EventHandler beans registered as subscribers with one or more EventBus beans.Exception handler that will handle errors that occur during
CommandBus.sendAndDontWait(Object)/CommandBus.sendAndDontWait(Object, Duration)Fallback
Note: If the
Instead use
SendAndDontWaitErrorHandler that only error logs any issues.Note: If the
SendAndDontWaitErrorHandler.FallbackSendAndDontWaitErrorHandler is used with a Durable Command Bus (e.g. using DurableQueues),
then any failing command will not be retried.Instead use
SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandlerFallback
The
SendAndDontWaitErrorHandler that error logs any issues and rethrows the exception.The
SendAndDontWaitErrorHandler.RethrowingSendAndDontWaitErrorHandler is compatible with a Durable Command Bus (e.g. using DurableQueues),
as rethrowing the exceptions allows the command to be retried