@RestController @RequestMapping(value="/spring-command-bus-connector") public class SpringHttpCommandBusConnector extends Object implements org.axonframework.commandhandling.distributed.CommandBusConnector
CommandBusConnector implementation based on Spring Rest characteristics. Serves as a RestController
to receive Command Messages for its node, but also contains a RestOperations component to send Command
Messages to other nodes. Will use a localCommandBus of type CommandBus to publish any received
Command Messages to its local instance. Messages are de-/serialized using a Serializer. Lastly, an
Executor is used to make command handling and dispatching asynchronous, given that the configured
Executor use different threads or spawns new threads.| Modifier and Type | Class and Description |
|---|---|
static class |
SpringHttpCommandBusConnector.Builder
Builder class to instantiate a
SpringHttpCommandBusConnector. |
class |
SpringHttpCommandBusConnector.SpringHttpReplyFutureCallback<C,R> |
| Modifier | Constructor and Description |
|---|---|
protected |
SpringHttpCommandBusConnector(SpringHttpCommandBusConnector.Builder builder)
Instantiate a
SpringHttpCommandBusConnector based on the fields contained in the SpringHttpCommandBusConnector.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static SpringHttpCommandBusConnector.Builder |
builder()
Instantiate a Builder to be able to create a
SpringHttpCommandBusConnector. |
CompletableFuture<Void> |
initiateShutdown() |
Optional<org.axonframework.commandhandling.CommandBus> |
localSegment() |
<C,R> CompletableFuture<?> |
receiveCommand(SpringHttpDispatchMessage<C> dispatchMessage) |
org.axonframework.common.Registration |
registerHandlerInterceptor(org.axonframework.messaging.MessageHandlerInterceptor<? super org.axonframework.commandhandling.CommandMessage<?>> handlerInterceptor) |
<C> void |
send(org.axonframework.commandhandling.distributed.Member destination,
org.axonframework.commandhandling.CommandMessage<? extends C> commandMessage) |
<C,R> void |
send(org.axonframework.commandhandling.distributed.Member destination,
org.axonframework.commandhandling.CommandMessage<C> commandMessage,
org.axonframework.commandhandling.CommandCallback<? super C,R> callback) |
void |
start()
Start the Connector.
|
org.axonframework.common.Registration |
subscribe(String commandName,
org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> handler) |
protected SpringHttpCommandBusConnector(SpringHttpCommandBusConnector.Builder builder)
SpringHttpCommandBusConnector based on the fields contained in the SpringHttpCommandBusConnector.Builder.
Will assert that the localCommandBus of type (@link CommandBus}, RestOperations and
Serializer are not null, and will throw an AxonConfigurationException if any of them is
null.
builder - the SpringHttpCommandBusConnector.Builder used to instantiate a SpringHttpCommandBusConnector instance@StartHandler(phase=-134217728) public void start()
public static SpringHttpCommandBusConnector.Builder builder()
SpringHttpCommandBusConnector.
The Executor is defaulted to a DirectExecutor.INSTANCE and the SpanFactory to a
NoOpSpanFactory instance. The localCommandBus of type (@link CommandBus}, the
RestOperations and the Serializer are hard requirements and as such should be provided.
SpringHttpCommandBusConnectorpublic <C> void send(org.axonframework.commandhandling.distributed.Member destination,
@Nonnull
org.axonframework.commandhandling.CommandMessage<? extends C> commandMessage)
send in interface org.axonframework.commandhandling.distributed.CommandBusConnectorpublic <C,R> void send(org.axonframework.commandhandling.distributed.Member destination,
@Nonnull
org.axonframework.commandhandling.CommandMessage<C> commandMessage,
@Nonnull
org.axonframework.commandhandling.CommandCallback<? super C,R> callback)
send in interface org.axonframework.commandhandling.distributed.CommandBusConnectorpublic CompletableFuture<Void> initiateShutdown()
initiateShutdown in interface org.axonframework.commandhandling.distributed.CommandBusConnectorpublic org.axonframework.common.Registration subscribe(@Nonnull String commandName, @Nonnull org.axonframework.messaging.MessageHandler<? super org.axonframework.commandhandling.CommandMessage<?>> handler)
subscribe in interface org.axonframework.commandhandling.distributed.CommandBusConnectorpublic Optional<org.axonframework.commandhandling.CommandBus> localSegment()
localSegment in interface org.axonframework.commandhandling.distributed.CommandBusConnector@PostMapping(value="/command") public <C,R> CompletableFuture<?> receiveCommand(@RequestBody SpringHttpDispatchMessage<C> dispatchMessage)
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<?>>Copyright © 2010–2023. All rights reserved.