public class AxonServerCommandBus extends Object implements org.axonframework.commandhandling.CommandBus, org.axonframework.messaging.Distributed<org.axonframework.commandhandling.CommandBus>
CommandBus implementation that connects to Axon Server to submit and receive commands and command
responses. Delegates incoming commands to the provided localSegment.| Modifier and Type | Class and Description |
|---|---|
static class |
AxonServerCommandBus.Builder
Builder class to instantiate an
AxonServerCommandBus. |
| Constructor and Description |
|---|
AxonServerCommandBus(AxonServerCommandBus.Builder builder)
Instantiate a
AxonServerCommandBus based on the fields contained in the AxonServerCommandBus.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static AxonServerCommandBus.Builder |
builder()
Instantiate a Builder to be able to create an
AxonServerCommandBus. |
CompletableFuture<Void> |
disconnect()
Disconnect the command bus for receiving commands from Axon Server, by unsubscribing all registered command
handlers.
|
<C> void |
dispatch(org.axonframework.commandhandling.CommandMessage<C> command) |
<C,R> void |
dispatch(org.axonframework.commandhandling.CommandMessage<C> commandMessage,
org.axonframework.commandhandling.CommandCallback<? super C,? super R> commandCallback) |
org.axonframework.commandhandling.CommandBus |
localSegment() |
org.axonframework.common.Registration |
registerDispatchInterceptor(org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> dispatchInterceptor) |
org.axonframework.common.Registration |
registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> handlerInterceptor) |
CompletableFuture<Void> |
shutdownDispatching()
Shutdown the command bus asynchronously for dispatching commands to Axon Server.
|
void |
start()
Start the Axon Server
CommandBus implementation. |
org.axonframework.common.Registration |
subscribe(String commandName,
org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> messageHandler) |
public AxonServerCommandBus(AxonServerCommandBus.Builder builder)
AxonServerCommandBus based on the fields contained in the AxonServerCommandBus.Builder.builder - the AxonServerCommandBus.Builder used to instantiate a AxonServerCommandBus instancepublic static AxonServerCommandBus.Builder builder()
AxonServerCommandBus.
The CommandPriorityCalculator is defaulted to CommandPriorityCalculator.defaultCommandPriorityCalculator()
and the TargetContextResolver defaults to a lambda returning the AxonServerConfiguration.getContext() as the context. The ExecutorServiceBuilder defaults to ExecutorServiceBuilder.defaultCommandExecutorServiceBuilder(). The AxonServerConnectionManager, the
AxonServerConfiguration, the local CommandBus, Serializer and the RoutingStrategy
are a hard requirements and as such should be provided.
AxonServerCommandBus@StartHandler(phase=536870911) public void start()
CommandBus implementation.public <C> void dispatch(org.axonframework.commandhandling.CommandMessage<C> command)
dispatch in interface org.axonframework.commandhandling.CommandBuspublic <C,R> void dispatch(org.axonframework.commandhandling.CommandMessage<C> commandMessage,
org.axonframework.commandhandling.CommandCallback<? super C,? super R> commandCallback)
dispatch in interface org.axonframework.commandhandling.CommandBuspublic org.axonframework.common.Registration subscribe(String commandName, org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> messageHandler)
subscribe in interface org.axonframework.commandhandling.CommandBuspublic org.axonframework.commandhandling.CommandBus localSegment()
localSegment in interface org.axonframework.messaging.Distributed<org.axonframework.commandhandling.CommandBus>public org.axonframework.common.Registration registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> handlerInterceptor)
registerHandlerInterceptor in interface org.axonframework.messaging.MessageHandlerInterceptorSupport<org.axonframework.commandhandling.CommandMessage<?>>public org.axonframework.common.Registration registerDispatchInterceptor(org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> dispatchInterceptor)
registerDispatchInterceptor in interface org.axonframework.messaging.MessageDispatchInterceptorSupport<org.axonframework.commandhandling.CommandMessage<?>>@ShutdownHandler(phase=536870911) public CompletableFuture<Void> disconnect()
Phase.INBOUND_COMMAND_CONNECTOR phase.@ShutdownHandler(phase=0) public CompletableFuture<Void> shutdownDispatching()
Phase.OUTBOUND_COMMAND_CONNECTORS phase.Copyright © 2010–2021. All rights reserved.