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.boolean
boolean
void
setAutoStartup
(boolean autoStart) Set auto startup.void
setBeanName
(String beanName) void
setConsumerCustomizer
(ConsumerCustomizer consumerCustomizer) Customize the consumer builder before it is built.void
setListenerId
(String listenerId) Set the listener id.void
setQueueNames
(String... queueNames) Set the queue names.void
setStreamConverter
(StreamMessageConverter messageConverter) void
setupMessageListener
(MessageListener messageListener) Setup the message listener to use.void
start()
void
stop()
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 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:MessageListenerContainer
Set the queue names.- Specified by:
setQueueNames
in 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:MessageListenerContainer
Set the listener id.- Specified by:
setListenerId
in interfaceMessageListenerContainer
- Parameters:
listenerId
- the id.
-
getBeanName
Return the bean name.- Returns:
- the bean name.
-
setBeanName
- Specified by:
setBeanName
in interfaceBeanNameAware
-
setAutoStartup
public void setAutoStartup(boolean autoStart) Description copied from interface:MessageListenerContainer
Set auto startup.- Specified by:
setAutoStartup
in interfaceMessageListenerContainer
- Parameters:
autoStart
- true to auto start.
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
getMessageListener
Description copied from interface:MessageListenerContainer
Get the message listener.- Specified by:
getMessageListener
in interfaceMessageListenerContainer
- Returns:
- The message listener object.
-
isRunning
public boolean isRunning() -
start
public void start() -
stop
public void stop() -
setupMessageListener
Description copied from interface:MessageListenerContainer
Setup the message listener to use. Throws anIllegalArgumentException
if that message listener type is not supported.- Specified by:
setupMessageListener
in interfaceMessageListenerContainer
- Parameters:
messageListener
- theobject
to wrapped to theMessageListener
.
-