org.axonframework.eventhandling.amqp.spring
Class ListenerContainerLifecycleManager
java.lang.Object
org.axonframework.eventhandling.amqp.spring.ListenerContainerFactory
org.axonframework.eventhandling.amqp.spring.ListenerContainerLifecycleManager
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
public class ListenerContainerLifecycleManager
- extends ListenerContainerFactory
- implements org.springframework.context.SmartLifecycle, org.springframework.beans.factory.DisposableBean
Manages the lifecycle of the SimpleMessageListenerContainers that have been created to receive messages for
Clusters. The ListenerContainerLifecycleManager starts each of the Listener Containers when the context is started
and will stop each of them when the context is being shut down.
This class must be defined as a top-level Spring bean.
- Since:
- 2.0
- Author:
- Allard Buijze
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListenerContainerLifecycleManager
public ListenerContainerLifecycleManager()
registerCluster
public void registerCluster(Cluster cluster,
AMQPConsumerConfiguration config,
AMQPMessageConverter messageConverter)
- Registers the given
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 queue
- Parameters:
cluster
- 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 Message
isAutoStartup
public boolean isAutoStartup()
- Specified by:
isAutoStartup
in interface org.springframework.context.SmartLifecycle
stop
public void stop(Runnable callback)
- Specified by:
stop
in interface org.springframework.context.SmartLifecycle
start
public void start()
- Specified by:
start
in interface org.springframework.context.Lifecycle
stop
public void stop()
- Specified by:
stop
in interface org.springframework.context.Lifecycle
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interface org.springframework.context.Lifecycle
destroy
public void destroy()
throws Exception
- Specified by:
destroy
in interface org.springframework.beans.factory.DisposableBean
- Throws:
Exception
getPhase
public int getPhase()
- Specified by:
getPhase
in interface org.springframework.context.Phased
setPhase
public void setPhase(int phase)
- Defines the phase in which Spring should manage this beans lifecycle. Defaults to
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.
- Parameters:
phase
- The phase for the lifecycle- See Also:
SmartLifecycle
setDefaultConfiguration
public void setDefaultConfiguration(SpringAMQPConsumerConfiguration defaultConfiguration)
- Sets the configuration with the entries to use as defaults in case a registered cluster does not provide
explicit values.
- Parameters:
defaultConfiguration
- The configuration instance containing defaults for each registered cluster
Copyright © 2010-2016. All Rights Reserved.