K - the key type.V - the value type.public abstract class AbstractKafkaListenerEndpoint<K,V> extends java.lang.Object implements KafkaListenerEndpoint, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean
MethodKafkaListenerEndpoint,
SimpleKafkaListenerEndpoint| Constructor and Description |
|---|
AbstractKafkaListenerEndpoint() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected abstract MessageListener<K,V> |
createMessageListener(MessageListenerContainer container,
MessageConverter messageConverter)
Create a
MessageListener that is able to serve this endpoint for the
specified container. |
protected org.springframework.beans.factory.config.BeanExpressionContext |
getBeanExpressionContext() |
protected org.springframework.beans.factory.BeanFactory |
getBeanFactory() |
protected java.lang.StringBuilder |
getEndpointDescription()
Return a description for this endpoint.
|
java.lang.String |
getGroup()
Return the group of this endpoint or null if not in a group.
|
java.lang.String |
getId()
Return the id of this endpoint.
|
protected RecordFilterStrategy<K,V> |
getRecordFilterStrategy() |
protected org.springframework.retry.RecoveryCallback<?> |
getRecoveryCallback() |
protected org.springframework.beans.factory.config.BeanExpressionResolver |
getResolver() |
protected org.springframework.retry.support.RetryTemplate |
getRetryTemplate() |
java.util.Collection<TopicPartitionInitialOffset> |
getTopicPartitions()
Return the topicPartitions for this endpoint.
|
java.util.regex.Pattern |
getTopicPattern()
Return the topicPattern for this endpoint.
|
java.util.Collection<java.lang.String> |
getTopics()
Return the topics for this endpoint.
|
protected boolean |
isAckDiscarded() |
void |
setAckDiscarded(boolean ackDiscarded)
Set to true if the
recordFilterStrategy is in use. |
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setGroup(java.lang.String group)
Set the group for the corresponding listener container.
|
void |
setId(java.lang.String id) |
void |
setRecordFilterStrategy(RecordFilterStrategy<K,V> recordFilterStrategy)
Set a
RecordFilterStrategy implementation. |
void |
setRecoveryCallback(org.springframework.retry.RecoveryCallback<java.lang.Void> recoveryCallback)
Set a callback to be used with the
retryTemplate. |
void |
setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
Set a retryTemplate.
|
void |
setTopicPartitions(TopicPartitionInitialOffset... topicPartitions)
Set the topicPartitions to use.
|
void |
setTopicPattern(java.util.regex.Pattern topicPattern)
Set the topic pattern to use.
|
void |
setTopics(java.lang.String... topics)
Set the topics to use.
|
void |
setupListenerContainer(MessageListenerContainer listenerContainer,
MessageConverter messageConverter)
Setup the specified message listener container with the model
defined by this endpoint.
|
java.lang.String |
toString() |
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
throws org.springframework.beans.BeansException
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwareorg.springframework.beans.BeansExceptionprotected org.springframework.beans.factory.BeanFactory getBeanFactory()
protected org.springframework.beans.factory.config.BeanExpressionResolver getResolver()
protected org.springframework.beans.factory.config.BeanExpressionContext getBeanExpressionContext()
public void setId(java.lang.String id)
public java.lang.String getId()
KafkaListenerEndpointgetId in interface KafkaListenerEndpointKafkaListenerContainerFactory.createListenerContainer(org.springframework.kafka.config.KafkaListenerEndpoint)public void setTopics(java.lang.String... topics)
topics - to set.setTopicPartitions(TopicPartitionInitialOffset...),
setTopicPattern(Pattern)public java.util.Collection<java.lang.String> getTopics()
getTopics in interface KafkaListenerEndpointpublic void setTopicPartitions(TopicPartitionInitialOffset... topicPartitions)
topicPartitions - to set.setTopics(String...),
setTopicPattern(Pattern)public java.util.Collection<TopicPartitionInitialOffset> getTopicPartitions()
getTopicPartitions in interface KafkaListenerEndpointpublic void setTopicPattern(java.util.regex.Pattern topicPattern)
topicPattern - the patternsetTopicPartitions(TopicPartitionInitialOffset...),
setTopics(String...)public java.util.regex.Pattern getTopicPattern()
getTopicPattern in interface KafkaListenerEndpointpublic java.lang.String getGroup()
KafkaListenerEndpointgetGroup in interface KafkaListenerEndpointpublic void setGroup(java.lang.String group)
group - the group.public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanprotected RecordFilterStrategy<K,V> getRecordFilterStrategy()
public void setRecordFilterStrategy(RecordFilterStrategy<K,V> recordFilterStrategy)
RecordFilterStrategy implementation.recordFilterStrategy - the strategy implementation.protected boolean isAckDiscarded()
public void setAckDiscarded(boolean ackDiscarded)
recordFilterStrategy is in use.ackDiscarded - the ackDiscarded.protected org.springframework.retry.support.RetryTemplate getRetryTemplate()
public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
retryTemplate - the template.protected org.springframework.retry.RecoveryCallback<?> getRecoveryCallback()
public void setRecoveryCallback(org.springframework.retry.RecoveryCallback<java.lang.Void> recoveryCallback)
retryTemplate.recoveryCallback - the callback.public void setupListenerContainer(MessageListenerContainer listenerContainer, MessageConverter messageConverter)
KafkaListenerEndpointThis endpoint must provide the requested missing option(s) of
the specified container to make it usable. Usually, this is about
setting the queues and the messageListener to
use but an implementation may override any default setting that
was already set.
setupListenerContainer in interface KafkaListenerEndpointlistenerContainer - the listener container to configuremessageConverter - the message converter - can be nullprotected abstract MessageListener<K,V> createMessageListener(MessageListenerContainer container, MessageConverter messageConverter)
MessageListener that is able to serve this endpoint for the
specified container.container - the MessageListenerContainer to create a MessageListener.messageConverter - the message converter - may be null.MessageListener instance.protected java.lang.StringBuilder getEndpointDescription()
Available to subclasses, for inclusion in their toString() result.
public java.lang.String toString()
toString in class java.lang.Object