public class ListenerContainerLifecycleManager extends ListenerContainerFactory implements org.springframework.context.SmartLifecycle, org.springframework.beans.factory.DisposableBean
Constructor and Description |
---|
ListenerContainerLifecycleManager() |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
int |
getPhase() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
registerCluster(Cluster cluster,
AMQPConsumerConfiguration config,
AMQPMessageConverter messageConverter)
Registers the given
cluster , assigning it to a listener that listens to the given
queueName . |
void |
setDefaultConfiguration(SpringAMQPConsumerConfiguration defaultConfiguration)
Sets the configuration with the entries to use as defaults in case a registered cluster does not provide
explicit values.
|
void |
setPhase(int phase)
Defines the phase in which Spring should manage this beans lifecycle.
|
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
afterPropertiesSet, createContainer, getApplicationContext, setApplicationContext, setConnectionFactory
public void registerCluster(Cluster cluster, AMQPConsumerConfiguration config, AMQPMessageConverter messageConverter)
cluster
, assigning it to a listener that listens to the given
queueName
. If no listener is present for the given queueName
, it is created. If one
already exists, it is assigned to the existing listener. Clusters that have been registered with the same
queueName
will each receive a copy of all message on that queuecluster
- The cluster to forward messages toconfig
- The configuration object for the clustermessageConverter
- The message converter to use to convert the AMQP Message to an Event Messagepublic boolean isAutoStartup()
isAutoStartup
in interface org.springframework.context.SmartLifecycle
public void stop(Runnable callback)
stop
in interface org.springframework.context.SmartLifecycle
public 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 void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
public int getPhase()
getPhase
in interface org.springframework.context.Phased
public void setPhase(int phase)
Integer.MAX_VALUE
(), which ensures the containers are started when the rest of the application context
has started, and are the first to shut down.phase
- The phase for the lifecycleSmartLifecycle
public void setDefaultConfiguration(SpringAMQPConsumerConfiguration defaultConfiguration)
defaultConfiguration
- The configuration instance containing defaults for each registered clusterCopyright © 2010-2013. All Rights Reserved.