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
Fields Modifier and Type Field Description protected Loglogger-
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
-
Constructor Summary
Constructors Constructor Description StreamListenerContainer(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetBeanName()Return the bean name.StringgetListenerId()The 'id' attribute of the listener.ObjectgetMessageListener()Get the message listener.StreamMessageConvertergetStreamConverter()booleanisAutoStartup()booleanisRunning()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, wait
-
Methods inherited from interface org.springframework.amqp.rabbit.listener.MessageListenerContainer
afterPropertiesSet, isConsumerBatchEnabled, lazyLoad
-
Methods inherited from interface org.springframework.context.SmartLifecycle
getPhase, stop
-
-
-
-
Field Detail
-
logger
protected Log logger
-
-
Constructor Detail
-
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 Detail
-
setQueueNames
public void setQueueNames(String... queueNames)
Description copied from interface:MessageListenerContainerSet the queue names.- Specified by:
setQueueNamesin interfaceMessageListenerContainer- Parameters:
queueNames- the queue names.
-
getStreamConverter
public StreamMessageConverter getStreamConverter()
- Returns:
- the converter.
-
setStreamConverter
public void setStreamConverter(StreamMessageConverter messageConverter)
- Parameters:
messageConverter- the converter.
-
setConsumerCustomizer
public void setConsumerCustomizer(ConsumerCustomizer consumerCustomizer)
Customize the consumer builder before it is built.- Parameters:
consumerCustomizer- the customizer.
-
getListenerId
@Nullable public String getListenerId()
The 'id' attribute of the listener.- Returns:
- the id (or the container bean name if no id set).
-
setListenerId
public void setListenerId(String listenerId)
Description copied from interface:MessageListenerContainerSet the listener id.- Specified by:
setListenerIdin interfaceMessageListenerContainer- Parameters:
listenerId- the id.
-
setBeanName
public void setBeanName(String beanName)
- 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
-
getMessageListener
@Nullable public Object getMessageListener()
Description copied from interface:MessageListenerContainerGet the message listener.- Specified by:
getMessageListenerin interfaceMessageListenerContainer- Returns:
- The message listener object.
-
setupMessageListener
public void setupMessageListener(MessageListener messageListener)
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.
-
-