K - the key type.V - the value type.public abstract class AbstractMessageListenerContainer<K,V> extends java.lang.Object implements GenericMessageListenerContainer<K,V>, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationEventPublisherAware
MessageListenerContainer.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMessageListenerContainer.AckMode
The offset commit behavior enumeration.
|
| Modifier and Type | Field and Description |
|---|---|
protected ConsumerFactory<K,V> |
consumerFactory |
static int |
DEFAULT_PHASE
The default
SmartLifecycle phase for listener containers 2147483547. |
protected org.apache.commons.logging.Log |
logger |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMessageListenerContainer(ConsumerFactory<K,V> consumerFactory,
ContainerProperties containerProperties)
Construct an instance with the provided factory and properties.
|
protected |
AbstractMessageListenerContainer(ContainerProperties containerProperties)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkGroupId() |
protected org.apache.kafka.clients.consumer.ConsumerRebalanceListener |
createSimpleLoggingConsumerRebalanceListener()
Return default implementation of
ConsumerRebalanceListener instance. |
protected abstract void |
doStart() |
protected abstract void |
doStop(java.lang.Runnable callback) |
protected AfterRollbackProcessor<K,V> |
getAfterRollbackProcessor() |
org.springframework.context.ApplicationEventPublisher |
getApplicationEventPublisher() |
java.lang.String |
getBeanName() |
ContainerProperties |
getContainerProperties()
Return the container properties for this container.
|
int |
getPhase() |
boolean |
isAutoStartup() |
protected boolean |
isPaused() |
boolean |
isPauseRequested()
Return true if
MessageListenerContainer.pause() has been called; the container might not have actually
paused yet. |
boolean |
isRunning() |
void |
pause()
Pause this container before the next poll().
|
void |
resume()
Resume this container, if paused, after the next poll().
|
void |
setAfterRollbackProcessor(AfterRollbackProcessor<K,V> afterRollbackProcessor)
Set a processor to perform seeks on unprocessed records after a rollback.
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setAutoStartup(boolean autoStartup) |
void |
setBeanName(java.lang.String name) |
void |
setPhase(int phase) |
protected void |
setRunning(boolean running) |
void |
setupMessageListener(java.lang.Object messageListener)
Setup the message listener to use.
|
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAssignedPartitions, isContainerPaused, metricspublic static final int DEFAULT_PHASE
SmartLifecycle phase for listener containers 2147483547.protected final org.apache.commons.logging.Log logger
protected final ConsumerFactory<K,V> consumerFactory
@Deprecated protected AbstractMessageListenerContainer(ContainerProperties containerProperties)
AbstractMessageListenerContainer(ConsumerFactory, ContainerProperties).containerProperties - the properties.protected AbstractMessageListenerContainer(ConsumerFactory<K,V> consumerFactory, ContainerProperties containerProperties)
consumerFactory - the factory.containerProperties - the properties.public void setBeanName(java.lang.String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic java.lang.String getBeanName()
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
protected void setRunning(boolean running)
public boolean isRunning()
isRunning in interface org.springframework.context.Lifecycleprotected boolean isPaused()
public boolean isPauseRequested()
MessageListenerContainerMessageListenerContainer.pause() has been called; the container might not have actually
paused yet.isPauseRequested in interface MessageListenerContainerpublic void setPhase(int phase)
public int getPhase()
getPhase in interface org.springframework.context.Phasedprotected AfterRollbackProcessor<K,V> getAfterRollbackProcessor()
public void setAfterRollbackProcessor(AfterRollbackProcessor<K,V> afterRollbackProcessor)
afterRollbackProcessor - the processor.public ContainerProperties getContainerProperties()
MessageListenerContainergetContainerProperties in interface MessageListenerContainerpublic void setupMessageListener(java.lang.Object messageListener)
MessageListenerContainerIllegalArgumentException
if that message listener type is not supported.setupMessageListener in interface MessageListenerContainermessageListener - the object to wrapped to the MessageListener.public final void start()
start in interface org.springframework.context.Lifecyclepublic void checkGroupId()
protected abstract void doStart()
public final void stop()
stop in interface org.springframework.context.Lifecyclepublic void pause()
MessageListenerContainerpause in interface MessageListenerContainerpublic void resume()
MessageListenerContainerresume in interface MessageListenerContainerpublic void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecycleprotected abstract void doStop(java.lang.Runnable callback)
protected final org.apache.kafka.clients.consumer.ConsumerRebalanceListener createSimpleLoggingConsumerRebalanceListener()
ConsumerRebalanceListener instance.ConsumerRebalanceListener currently assigned to this container.