public class JGroupsConnectorFactoryBean extends Object implements org.springframework.beans.factory.FactoryBean<JGroupsConnector>, org.springframework.beans.factory.InitializingBean, org.springframework.context.SmartLifecycle, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware
Constructor and Description |
---|
JGroupsConnectorFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
JGroupsConnector |
getObject() |
Class<?> |
getObjectType() |
int |
getPhase() |
protected JGroupsConnector |
instantiateConnector(CommandBus localSegment,
org.jgroups.JChannel channel,
String clusterName,
Serializer serializer,
RoutingStrategy routingStrategy) |
boolean |
isAutoStartup() |
boolean |
isRunning() |
boolean |
isSingleton() |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanName(String name) |
void |
setChannelFactory(JChannelFactory channelFactory)
Sets the JChannelFactory that allows programmatic definition of the JChannel.
|
void |
setChannelName(String channelName)
Optionally sets the logical channel name of the channel.
|
void |
setClusterName(String clusterName)
Sets the name of the cluster to subscribe to.
|
void |
setConfiguration(String configuration)
Sets the JGroups configuration file to load.
|
void |
setInterceptors(List<MessageHandlerInterceptor<CommandMessage<?>>> interceptors)
Sets the interceptor to use in the default local segment (a SimpleCommandBus).
|
void |
setJoinTimeout(long joinTimeout)
Sets the number of milliseconds to wait for this member to join the group.
|
void |
setLocalSegment(CommandBus localSegment)
Sets the CommandBus instance on which local commands must be dispatched.
|
void |
setPhase(int phase)
Sets the phase in which this bean must be started.
|
void |
setRegisterMBean(boolean registerMBean)
Registers the JChannel monitoring bean after the channel has connected.
|
void |
setRoutingStrategy(RoutingStrategy routingStrategy)
Sets the
RoutingStrategy that the JGroupsConnector will use to determine to which endpoint a message
should be routed. |
void |
setSerializer(Serializer serializer)
Sets the serializer used to serialize events before they are dispatched to the destination.
|
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
public JGroupsConnector getObject() throws Exception
getObject
in interface org.springframework.beans.factory.FactoryBean<JGroupsConnector>
Exception
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<JGroupsConnector>
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<JGroupsConnector>
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
protected JGroupsConnector instantiateConnector(CommandBus localSegment, org.jgroups.JChannel channel, String clusterName, Serializer serializer, RoutingStrategy routingStrategy)
public void setSerializer(Serializer serializer)
serializer
- the serializer to serialize commands withpublic void setConfiguration(String configuration)
JChannelFactory
.configuration
- the JGroups configuration filepublic void setRoutingStrategy(RoutingStrategy routingStrategy)
RoutingStrategy
that the JGroupsConnector will use to determine to which endpoint a message
should be routed.routingStrategy
- the routing strategy of the connectorpublic void setChannelFactory(JChannelFactory channelFactory)
channelFactory
- The factory that creates the JChannelpublic void setClusterName(String clusterName)
clusterName
- The name of the cluster to connect topublic void setChannelName(String channelName)
channelName
- The logical name to give to the channelpublic void setJoinTimeout(long joinTimeout)
start()
method to wait until the member joined the cluster.
Defaults to -1, which causes the start()
to wait indefinitely, until the member has joined the cluster.joinTimeout
- The number of milliseconds to wait for the member to join the clusterpublic void setLocalSegment(CommandBus localSegment)
localSegment
- the CommandBus instance to dispatch local messages onpublic void setInterceptors(List<MessageHandlerInterceptor<CommandMessage<?>>> interceptors)
setLocalSegment(org.axonframework.commandhandling.CommandBus)
), this configuration is ignored.interceptors
- the list of interceptors (in order) for the local segmentpublic void setRegisterMBean(boolean registerMBean)
registerMBean
- if true
the JGroups channel will be registered with the MBeanServerpublic void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public void setPhase(int phase)
Integer.MAX_VALUE
, which ensures the
Connector is started when other beans have been initialized.phase
- the phase in which the JGroups connector must be started.SmartLifecycle
public void setBeanName(String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
Copyright © 2010–2017. All rights reserved.