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| Constructor and Description |
|---|
AbstractKafkaListenerEndpoint() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected abstract MessagingMessageListenerAdapter<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 org.springframework.expression.BeanResolver |
getBeanResolver() |
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 |
getGroupId()
Return the groupId of this endpoint - if present, overrides the
group.id property of the consumer factory. |
java.lang.String |
getId()
Return the id of this endpoint.
|
protected RecordFilterStrategy<K,V> |
getRecordFilterStrategy() |
protected org.springframework.retry.RecoveryCallback<?> |
getRecoveryCallback() |
protected KafkaTemplate<K,V> |
getReplyTemplate() |
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() |
boolean |
isBatchListener()
Return true if this endpoint creates a batch listener.
|
void |
setAckDiscarded(boolean ackDiscarded)
Set to true if the
recordFilterStrategy is in use. |
void |
setBatchListener(boolean batchListener)
Set to true if this endpoint should create a batch listener.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setGroup(java.lang.String group)
Set the group for the corresponding listener container.
|
void |
setGroupId(java.lang.String groupId)
Set the group id to override the
group.id property in the
connectionFactory. |
void |
setId(java.lang.String id) |
void |
setRecordFilterStrategy(RecordFilterStrategy<K,V> recordFilterStrategy)
Set a
RecordFilterStrategy implementation. |
void |
setRecoveryCallback(org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
Set a callback to be used with the
retryTemplate. |
void |
setReplyTemplate(KafkaTemplate<K,V> replyTemplate)
Set the
KafkaTemplate to use to send replies. |
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()
protected org.springframework.expression.BeanResolver getBeanResolver()
public void setId(java.lang.String id)
public java.lang.String getId()
KafkaListenerEndpointgetId in interface KafkaListenerEndpointKafkaListenerContainerFactory.createListenerContainer(org.springframework.kafka.config.KafkaListenerEndpoint)public void setGroupId(java.lang.String groupId)
group.id property in the
connectionFactory.groupId - the group id.public java.lang.String getGroupId()
KafkaListenerEndpointgroup.id property of the consumer factory.getGroupId in interface KafkaListenerEndpointpublic 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 boolean isBatchListener()
public void setBatchListener(boolean batchListener)
batchListener - true for a batch listener.public void setReplyTemplate(KafkaTemplate<K,V> replyTemplate)
KafkaTemplate to use to send replies.replyTemplate - the template.protected KafkaTemplate<K,V> getReplyTemplate()
protected 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<? extends java.lang.Object> recoveryCallback)
retryTemplate.recoveryCallback - the callback.public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanpublic 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 MessagingMessageListenerAdapter<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