public class AxonServerCommandBus extends Object implements org.axonframework.commandhandling.CommandBus, org.axonframework.messaging.Distributed<org.axonframework.commandhandling.CommandBus>, org.axonframework.lifecycle.Lifecycle
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) |
void |
registerLifecycleHandlers(org.axonframework.lifecycle.Lifecycle.LifecycleRegistry handle) |
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(), the TargetContextResolver defaults
to a lambda returning the AxonServerConfiguration.getContext() as the context and the
CommandBusSpanFactory defaults to a DefaultCommandBusSpanFactory backed by a
NoOpSpanFactory. 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.
AxonServerCommandBuspublic void registerLifecycleHandlers(@Nonnull org.axonframework.lifecycle.Lifecycle.LifecycleRegistry handle)
registerLifecycleHandlers in interface org.axonframework.lifecycle.Lifecyclepublic void start()
CommandBus implementation.public <C> void dispatch(@Nonnull org.axonframework.commandhandling.CommandMessage<C> command)
dispatch in interface org.axonframework.commandhandling.CommandBuspublic <C,R> void dispatch(@Nonnull org.axonframework.commandhandling.CommandMessage<C> commandMessage, @Nonnull org.axonframework.commandhandling.CommandCallback<? super C,? super R> commandCallback)
dispatch in interface org.axonframework.commandhandling.CommandBuspublic org.axonframework.common.Registration subscribe(@Nonnull String commandName, @Nonnull 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(@Nonnull 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(@Nonnull org.axonframework.messaging.MessageDispatchInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> dispatchInterceptor)
registerDispatchInterceptor in interface org.axonframework.messaging.MessageDispatchInterceptorSupport<org.axonframework.commandhandling.CommandMessage<?>>public CompletableFuture<Void> disconnect()
Phase.INBOUND_COMMAND_CONNECTOR phase.public CompletableFuture<Void> shutdownDispatching()
Phase.OUTBOUND_COMMAND_CONNECTORS phase.Copyright © 2010–2024. All rights reserved.