public class AsynchronousCommandBus extends SimpleCommandBus
Executors.newCachedThreadPool()). It will reuse threads while possible, and shut them down after 60 seconds of inactivity. Each Command is dispatched in a separate task, which is processed by the Executor. Note that you should call
shutdown()to stop any threads waiting for new tasks. Failure to do so may cause the JVM to hang for up to 60 seconds on JVM shutdown.
|Modifier and Type||Class and Description|
Builder class to instantiate a
|Modifier||Constructor and Description|
|Modifier and Type||Method and Description|
Instantiate a Builder to be able to create a
Performs the actual handling logic.
Shuts down the Executor used to asynchronously dispatch incoming commands.
dispatch, dispatch, doDispatch, intercept, registerDispatchInterceptor, registerHandlerInterceptor, setRollbackConfiguration, subscribe
protected AsynchronousCommandBus(AsynchronousCommandBus.Builder builder)
AsynchronousCommandBusbased on the fields contained in the
public static AsynchronousCommandBus.Builder builder()
TransactionManager is defaulted to a
defaulted to a
RollbackConfiguration defaults to a
DuplicateCommandHandlerResolver defaults to
DuplicateCommandHandlerResolution.logAndOverride() and the
Executor defaults to a
Executors.newCachedThreadPool(). The default
executor uses an
AxonThreadFactory to create
threads with a sensible naming scheme. The TransactionManager, MessageMonitor, RollbackConfiguration and Executor
are hard requirements. Thus setting them to
null will result in an
protected <C,R> void handle(CommandMessage<C> command, MessageHandler<? super CommandMessage<?>> handler, CommandCallback<? super C,? super R> callback)
C- The type of payload of the command
R- The type of result expected from the command handler
command- The actual command to handle
handler- The handler that must be invoked for this command
callback- The callback to notify of the result
public void shutdown()
Executorprovided in the constructor does not implement
ExecutorService, this method does nothing.
Copyright © 2010–2021. All rights reserved.