Class StreamListenerContainer
java.lang.Object
org.springframework.rabbit.stream.listener.StreamListenerContainer
- All Implemented Interfaces:
MessageListenerContainer,Aware,BeanNameAware,InitializingBean,Lifecycle,Phased,SmartLifecycle
public class StreamListenerContainer
extends Object
implements MessageListenerContainer, BeanNameAware
A listener container for RabbitMQ Streams.
- Since:
- 2.4
- Author:
- Gary Russell
-
Field Summary
FieldsFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionStreamListenerContainer(com.rabbitmq.stream.Environment environment) Construct an instance using the provided environment.StreamListenerContainer(com.rabbitmq.stream.Environment environment, com.rabbitmq.stream.Codec codec) Construct an instance using the provided environment and codec. -
Method Summary
Modifier and TypeMethodDescriptionReturn the bean name.The 'id' attribute of the listener.Get the message listener.booleanbooleanvoidsetAdviceChain(Advice... advices) Set an advice chain to apply to the listener.voidsetAutoStartup(boolean autoStart) Set auto startup.voidsetBeanName(String beanName) voidsetConsumerCustomizer(ConsumerCustomizer consumerCustomizer) Customize the consumer builder before it is built.voidsetListenerId(String listenerId) Set the listener id.voidsetQueueNames(String... queueNames) Set the queue names.voidsetStreamConverter(StreamMessageConverter messageConverter) voidsetupMessageListener(MessageListener messageListener) Setup the message listener to use.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.amqp.rabbit.listener.MessageListenerContainer
afterPropertiesSet, isConsumerBatchEnabled, lazyLoadMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, stop
-
Field Details
-
logger
-
-
Constructor Details
-
StreamListenerContainer
public StreamListenerContainer(com.rabbitmq.stream.Environment environment) Construct an instance using the provided environment.- Parameters:
environment- the environment.
-
StreamListenerContainer
public StreamListenerContainer(com.rabbitmq.stream.Environment environment, @Nullable com.rabbitmq.stream.Codec codec) Construct an instance using the provided environment and codec.- Parameters:
environment- the environment.codec- the codec used to create reply messages.
-
-
Method Details
-
setQueueNames
Description copied from interface:MessageListenerContainerSet the queue names.- Specified by:
setQueueNamesin interfaceMessageListenerContainer- Parameters:
queueNames- the queue names.
-
getStreamConverter
- Returns:
- the converter.
-
setStreamConverter
- Parameters:
messageConverter- the converter.
-
setConsumerCustomizer
Customize the consumer builder before it is built.- Parameters:
consumerCustomizer- the customizer.
-
getListenerId
The 'id' attribute of the listener.- Returns:
- the id (or the container bean name if no id set).
-
setListenerId
Description copied from interface:MessageListenerContainerSet the listener id.- Specified by:
setListenerIdin interfaceMessageListenerContainer- Parameters:
listenerId- the id.
-
getBeanName
Return the bean name.- Returns:
- the bean name.
-
setBeanName
- Specified by:
setBeanNamein interfaceBeanNameAware
-
setAutoStartup
public void setAutoStartup(boolean autoStart) Description copied from interface:MessageListenerContainerSet auto startup.- Specified by:
setAutoStartupin interfaceMessageListenerContainer- Parameters:
autoStart- true to auto start.
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceSmartLifecycle
-
setAdviceChain
Set an advice chain to apply to the listener.- Parameters:
advices- the advice chain.- Since:
- 2.4.5
-
getMessageListener
Description copied from interface:MessageListenerContainerGet the message listener.- Specified by:
getMessageListenerin interfaceMessageListenerContainer- Returns:
- The message listener object.
-
isRunning
public boolean isRunning() -
start
public void start() -
stop
public void stop() -
setupMessageListener
Description copied from interface:MessageListenerContainerSetup the message listener to use. Throws anIllegalArgumentExceptionif that message listener type is not supported.- Specified by:
setupMessageListenerin interfaceMessageListenerContainer- Parameters:
messageListener- theobjectto wrapped to theMessageListener.
-