K - the key type.V - the value type.public abstract class AbstractMessageListenerContainer<K,V> extends java.lang.Object implements MessageListenerContainer, org.springframework.beans.factory.BeanNameAware, org.springframework.context.SmartLifecycle
MessageListenerContainer.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMessageListenerContainer.AckMode
The offset commit behavior enumeration.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
AbstractMessageListenerContainer() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
doStart() |
protected abstract void |
doStop() |
int |
getAckCount()
Return the count.
|
AbstractMessageListenerContainer.AckMode |
getAckMode()
Return the
AbstractMessageListenerContainer.AckMode. |
long |
getAckTime()
Return the ack time.
|
java.lang.String |
getBeanName() |
ErrorHandler |
getErrorHandler() |
java.lang.Object |
getMessageListener() |
int |
getPhase() |
long |
getPollTimeout()
Return the poll timeout.
|
java.util.concurrent.Executor |
getTaskExecutor() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
void |
setAckCount(int count)
Set the number of outstanding record count after which offsets should be committed
when
AbstractMessageListenerContainer.AckMode.COUNT or AbstractMessageListenerContainer.AckMode.COUNT_TIME is being used. |
void |
setAckMode(AbstractMessageListenerContainer.AckMode ackMode)
The ack mode to use when auto ack (in the configuration properties) is
false.
|
void |
setAckTime(long millis)
Set the time (ms) after which outstanding offsets should be committed
when
AbstractMessageListenerContainer.AckMode.TIME or AbstractMessageListenerContainer.AckMode.COUNT_TIME is being used. |
void |
setAutoStartup(boolean autoStartup) |
void |
setBeanName(java.lang.String name) |
void |
setErrorHandler(ErrorHandler errorHandler) |
void |
setMessageListener(java.lang.Object messageListener)
Set the message listener; must be a
MessageListener or
AcknowledgingMessageListener. |
void |
setPhase(int phase) |
void |
setPollTimeout(long pollTimeout)
The max time to block in the consumer waiting for records.
|
protected void |
setRunning(boolean running) |
void |
setTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor) |
void |
setupMessageListener(java.lang.Object messageListener)
Setup the message listener to use.
|
void |
start() |
void |
stop() |
void |
stop(java.lang.Runnable callback) |
public void setBeanName(java.lang.String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic java.lang.String getBeanName()
public void setMessageListener(java.lang.Object messageListener)
MessageListener or
AcknowledgingMessageListener.messageListener - the listener.public java.lang.Object getMessageListener()
public 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 void setAckMode(AbstractMessageListenerContainer.AckMode ackMode)
#setPollTimeout(long) pollTimeout.AcknowledgingMessageListener.
ackMode - the AbstractMessageListenerContainer.AckMode; default BATCH.public AbstractMessageListenerContainer.AckMode getAckMode()
AbstractMessageListenerContainer.AckMode.AbstractMessageListenerContainer.AckModesetAckMode(AckMode)public void setPollTimeout(long pollTimeout)
pollTimeout - the timeout in ms; default 1000.public long getPollTimeout()
setPollTimeout(long)public void setAckCount(int count)
AbstractMessageListenerContainer.AckMode.COUNT or AbstractMessageListenerContainer.AckMode.COUNT_TIME is being used.count - the countpublic int getAckCount()
setAckCount(int)public void setAckTime(long millis)
AbstractMessageListenerContainer.AckMode.TIME or AbstractMessageListenerContainer.AckMode.COUNT_TIME is being used. Should
be larger thanmillis - the timepublic long getAckTime()
setAckTime(long)public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void setAutoStartup(boolean autoStartup)
public final void start()
start in interface org.springframework.context.Lifecycleprotected abstract void doStart()
public final void stop()
stop in interface org.springframework.context.Lifecyclepublic void stop(java.lang.Runnable callback)
stop in interface org.springframework.context.SmartLifecycleprotected abstract void doStop()
protected void setRunning(boolean running)
public boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic void setPhase(int phase)
public int getPhase()
getPhase in interface org.springframework.context.Phasedpublic ErrorHandler getErrorHandler()
public void setErrorHandler(ErrorHandler errorHandler)
public java.util.concurrent.Executor getTaskExecutor()
public void setTaskExecutor(java.util.concurrent.Executor fetchTaskExecutor)