|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.commandhandling.gateway.AbstractCommandGateway org.axonframework.commandhandling.gateway.DefaultCommandGateway
public class DefaultCommandGateway
Default implementation of the CommandGateway interface. It allow configuration of a RetryScheduler
and
CommandDispatchInterceptors
. The Retry Scheduler allows for Command to be
automatically retried when a non-transient exception occurs. The Command Dispatch Interceptors can intercept and
alter command dispatched on this specific gateway. Typically, this would be used to add gateway specific meta data
to the Command.
Constructor Summary | |
---|---|
DefaultCommandGateway(CommandBus commandBus,
CommandDispatchInterceptor... commandDispatchInterceptors)
Initializes a command gateway that dispatches commands to the given commandBus after they have been
handles by the given commandDispatchInterceptors . |
|
DefaultCommandGateway(CommandBus commandBus,
RetryScheduler retryScheduler,
CommandDispatchInterceptor... commandDispatchInterceptors)
Initializes a command gateway that dispatches commands to the given commandBus after they have been
handles by the given commandDispatchInterceptors . |
|
DefaultCommandGateway(CommandBus commandBus,
RetryScheduler retryScheduler,
List<CommandDispatchInterceptor> commandDispatchInterceptors)
Initializes a command gateway that dispatches commands to the given commandBus after they have been
handles by the given commandDispatchInterceptors . |
Method Summary | ||
---|---|---|
void |
send(Object command)
Sends the given command and returns immediately. |
|
|
send(Object command,
CommandCallback<R> callback)
Sends the given command , and invokes the callback when the command is processed. |
|
|
sendAndWait(Object command)
Sends the given command and waits for its execution to complete, or until the waiting thread is
interrupted. |
|
|
sendAndWait(Object command,
long timeout,
TimeUnit unit)
Sends the given command and waits for its execution to complete, or until the given
timeout has expired, or the waiting thread is interrupted. |
Methods inherited from class org.axonframework.commandhandling.gateway.AbstractCommandGateway |
---|
processInterceptors, sendAndForget |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultCommandGateway(CommandBus commandBus, CommandDispatchInterceptor... commandDispatchInterceptors)
commandBus
after they have been
handles by the given commandDispatchInterceptors
. Commands will not be retried when command
execution fails.
commandBus
- The CommandBus on which to dispatch the Command MessagescommandDispatchInterceptors
- The interceptors to invoke before dispatching commands to the Command Buspublic DefaultCommandGateway(CommandBus commandBus, RetryScheduler retryScheduler, CommandDispatchInterceptor... commandDispatchInterceptors)
commandBus
after they have been
handles by the given commandDispatchInterceptors
. When command execution results in an unchecked
exception, the given retryScheduler
is invoked to allow it to retry that command.
execution fails.
commandBus
- The CommandBus on which to dispatch the Command MessagesretryScheduler
- The scheduler that will decide whether to reschedule commandscommandDispatchInterceptors
- The interceptors to invoke before dispatching commands to the Command Buspublic DefaultCommandGateway(CommandBus commandBus, RetryScheduler retryScheduler, List<CommandDispatchInterceptor> commandDispatchInterceptors)
commandBus
after they have been
handles by the given commandDispatchInterceptors
. When command execution results in an unchecked
exception, the given retryScheduler
is invoked to allow it to retry that command.
execution fails.
commandBus
- The CommandBus on which to dispatch the Command MessagesretryScheduler
- The scheduler that will decide whether to reschedule commandscommandDispatchInterceptors
- The interceptors to invoke before dispatching commands to the Command BusMethod Detail |
---|
public <R> void send(Object command, CommandCallback<R> callback)
AbstractCommandGateway
command
, and invokes the callback
when the command is processed.
send
in interface CommandGateway
send
in class AbstractCommandGateway
R
- The type of response expected from the commandcommand
- The command to dispatchcallback
- The callback to notify with the processing resultpublic <R> R sendAndWait(Object command)
command
and waits for its execution to complete, or until the waiting thread is
interrupted.
sendAndWait
in interface CommandGateway
R
- The expected type of return valuecommand
- The command to send
CommandExecutionException
- when command execution threw a checked exceptionpublic <R> R sendAndWait(Object command, long timeout, TimeUnit unit)
command
and waits for its execution to complete, or until the given
timeout
has expired, or the waiting thread is interrupted.
When the timeout occurs, or the thread is interrupted, this method returns null
.
sendAndWait
in interface CommandGateway
R
- The expected type of return valuecommand
- The command to sendtimeout
- The maximum time to waitunit
- The time unit of the timeout argument
CommandExecutionException
- when command execution threw a checked exceptionpublic void send(Object command)
command
and returns immediately. This implementation
send
in interface CommandGateway
command
- The command to send
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |