T
- The type of gateway to be created by this factory bean. Note that the correct interface must also be set
using setGatewayInterface(Class)
. Failure to do so may result in class cast exceptions.public class CommandGatewayFactoryBean<T> extends Object implements org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean
CommandGateway
interface is assumed.
For details about the structure of compatible interfaces, see CommandGatewayFactory
.CommandGatewayFactory
Constructor and Description |
---|
CommandGatewayFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
addCommandDispatchInterceptor(MessageDispatchInterceptor<CommandMessage<?>> messageDispatchInterceptor)
Add an interceptor that should be invoked before a command is dispatched the the Command Bus.
|
void |
afterPropertiesSet() |
T |
getObject() |
Class<?> |
getObjectType() |
boolean |
isSingleton() |
void |
setCommandBus(CommandBus commandBus)
Sets the command bus on which the Gateway must dispatch commands.
|
void |
setCommandCallbacks(List<CommandCallback<?,?>> commandCallbacks)
Registers the
commandCallbacks , which are invoked for each sent command, unless Axon is able to
detect
that the result of the command does not match the type accepted by that callback. |
void |
setCommandDispatchInterceptors(List<MessageDispatchInterceptor<CommandMessage<?>>> messageDispatchInterceptors)
Sets the interceptors that should be invoked before a command is dispatched the the Command Bus.
|
void |
setGatewayInterface(Class<T> gatewayInterface)
Sets the interface that describes the gateway instance to describe.
|
void |
setRetryScheduler(RetryScheduler retryScheduler)
Sets the RetryScheduler that will be invoked when a command fails execution.
|
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<T>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<T>
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public void setCommandBus(CommandBus commandBus)
commandBus
- the command bus on which the Gateway must dispatch commandspublic void setRetryScheduler(RetryScheduler retryScheduler)
retryScheduler
- the RetryScheduler that will be invoked when a command fails executionpublic void setGatewayInterface(Class<T> gatewayInterface)
CommandGateway
.gatewayInterface
- The interface describing the gatewayIllegalArgumentException
- if the given gatewayInterface
is null
or not an
interface.public void addCommandDispatchInterceptor(MessageDispatchInterceptor<CommandMessage<?>> messageDispatchInterceptor)
messageDispatchInterceptor
- the interceptor that should be invoked before a command is dispatched the
the Command Buspublic void setCommandDispatchInterceptors(List<MessageDispatchInterceptor<CommandMessage<?>>> messageDispatchInterceptors)
messageDispatchInterceptors
- the interceptors that should be invoked before a command is dispatched the
the
Command Buspublic void setCommandCallbacks(List<CommandCallback<?,?>> commandCallbacks)
commandCallbacks
, which are invoked for each sent command, unless Axon is able to
detect
that the result of the command does not match the type accepted by that callback.
Axon will check the signature of the onSuccess() method and only invoke the callback if the actual result of the
command is an instance of that type. If Axon is unable to detect the type, the callback is always invoked,
potentially causing ClassCastException
.commandCallbacks
- The callbacks to registerCopyright © 2010–2017. All rights reserved.