org.axonframework.commandhandling.gateway
Class AbstractCommandGateway

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

public abstract class AbstractCommandGateway
extends Object

Author:
Allard Buijze

Constructor Summary
protected AbstractCommandGateway(CommandBus commandBus, RetryScheduler retryScheduler, List<CommandDispatchInterceptor> commandDispatchInterceptors)
          Initialize the AbstractCommandGateway with given commandBus, retryScheduler and commandDispatchInterceptors.
 
Method Summary
protected
<R> FutureCallback<R>
doSend(Object command)
          Dispatches a command and returns a Future from which the processing results can be retrieved.
protected  CommandMessage processInterceptors(CommandMessage commandMessage)
          Invokes all the dispatch interceptors and returns the CommandMessage instance that should be dispatched.
protected
<R> void
send(Object command, CommandCallback<R> callback)
          Sends the given command, and invokes the callback when the command is processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommandGateway

protected AbstractCommandGateway(CommandBus commandBus,
                                 RetryScheduler retryScheduler,
                                 List<CommandDispatchInterceptor> commandDispatchInterceptors)
Initialize the AbstractCommandGateway with given commandBus, retryScheduler and commandDispatchInterceptors.

Parameters:
commandBus - The command bus on which to dispatch events
retryScheduler - The scheduler capable of performing retries of failed commands. May be null when to prevent retries.
commandDispatchInterceptors - The interceptors to invoke when dispatching a command
Method Detail

send

protected <R> void send(Object command,
                        CommandCallback<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

processInterceptors

protected CommandMessage processInterceptors(CommandMessage 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

doSend

protected <R> FutureCallback<R> doSend(Object command)
Dispatches a command and returns a Future from which the processing results can be retrieved.

Type Parameters:
R - The expected result of the command
Parameters:
command - The command to dispatch
Returns:
a future providing access to the command's result


Copyright © 2010-2012. All Rights Reserved.