Package io.awspring.cloud.sqs.listener
Class DefaultListenerContainerRegistry
java.lang.Object
io.awspring.cloud.sqs.listener.DefaultListenerContainerRegistry
- All Implemented Interfaces:
MessageListenerContainerRegistry,Lifecycle,Phased,SmartLifecycle
public class DefaultListenerContainerRegistry
extends Object
implements MessageListenerContainerRegistry
MessageListenerContainerRegistry implementation that registers the MessageListenerContainer instances
and manage their lifecycle.
This bean can be autowired and used to lookup container instances at runtime, which can be useful to e.g. manually
manage their lifecycle.
A LifecycleHandler is used to manage the containers' lifecycle.
Only containers created via SqsListener annotations are registered by the
framework.- Since:
- 3.0
- Author:
- Tomaz Fernandes
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn theMessageListenerContainerinstance registered within this registry with the provided id, or null if none.Return theMessageListenerContainerinstances registered within this registry.intgetPhase()booleanvoidregisterListenerContainer(MessageListenerContainer<?> listenerContainer) Register aMessageListenerContainerinstance with this registry.voidsetPhase(int phase) voidstart()voidstop()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isAutoStartup, stop
-
Constructor Details
-
DefaultListenerContainerRegistry
public DefaultListenerContainerRegistry()
-
-
Method Details
-
registerListenerContainer
Description copied from interface:MessageListenerContainerRegistryRegister aMessageListenerContainerinstance with this registry.- Specified by:
registerListenerContainerin interfaceMessageListenerContainerRegistry- Parameters:
listenerContainer- the instance.
-
getListenerContainers
Description copied from interface:MessageListenerContainerRegistryReturn theMessageListenerContainerinstances registered within this registry.- Specified by:
getListenerContainersin interfaceMessageListenerContainerRegistry- Returns:
- the container instances.
-
getContainerById
Description copied from interface:MessageListenerContainerRegistryReturn theMessageListenerContainerinstance registered within this registry with the provided id, or null if none.- Specified by:
getContainerByIdin interfaceMessageListenerContainerRegistry- Parameters:
id- the id.- Returns:
- the container instance.
-
start
public void start() -
stop
public void stop() -
isRunning
public boolean isRunning() -
getPhase
public int getPhase()- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle
-
setPhase
public void setPhase(int phase)
-