Class AbstractCommandGateway

java.lang.Object
org.axonframework.commandhandling.gateway.AbstractCommandGateway
Direct Known Subclasses:
DefaultCommandGateway

public abstract class AbstractCommandGateway extends Object
Abstract implementation of a CommandGateway, which handles the dispatch interceptors and retrying on failure. The actual dispatching of commands is left to the subclasses.
Since:
2.2
Author:
Allard Buijze
  • Constructor Details

  • Method Details

    • send

      protected <C, R> void send(@Nonnull C command, @Nonnull CommandCallback<? super C,? super R> callback)
      Sends the given command, and invokes the callback when the command is processed.
      Type Parameters:
      R - The type of response expected from the command
      Parameters:
      command - The command to dispatch
      callback - The callback to notify with the processing result
    • sendAndForget

      protected void sendAndForget(Object command)
      Dispatches a command without callback. When dispatching fails, since there is no callback, the command will not be retried.
      Parameters:
      command - The command to dispatch
    • registerDispatchInterceptor

      protected Registration registerDispatchInterceptor(@Nonnull MessageDispatchInterceptor<? super CommandMessage<?>> interceptor)
      Registers a command dispatch interceptor within a CommandGateway.
      Parameters:
      interceptor - To intercept command messages
      Returns:
      a registration which can be used to cancel the registration of given interceptor
    • processInterceptors

      protected <C> CommandMessage<? extends C> processInterceptors(CommandMessage<C> commandMessage)
      Invokes all the dispatch interceptors and returns the CommandMessage instance that should be dispatched.
      Parameters:
      commandMessage - The incoming command message
      Returns:
      The command message to dispatch
    • getCommandBus

      public CommandBus getCommandBus()
      Returns the CommandBus used by this gateway. Should be used to monitoring or testing.
      Returns:
      The CommandBus used by this gateway