C - the AbstractMessageListenerContainer implementation type.K - the key type.V - the value type.public abstract class AbstractKafkaListenerContainerFactory<C extends AbstractMessageListenerContainer<K,V>,K,V> extends java.lang.Object implements KafkaListenerContainerFactory<C>, org.springframework.context.ApplicationEventPublisherAware
KafkaListenerContainerFactory for Spring's base container implementation.AbstractMessageListenerContainer| Constructor and Description |
|---|
AbstractKafkaListenerContainerFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract C |
createContainerInstance(KafkaListenerEndpoint endpoint)
Create an empty container instance.
|
C |
createListenerContainer(KafkaListenerEndpoint endpoint)
Create a
MessageListenerContainer for the given KafkaListenerEndpoint. |
ConsumerFactory<K,V> |
getConsumerFactory() |
ContainerProperties |
getContainerProperties()
Obtain the properties template for this factory - set properties as needed
and they will be copied to a final properties instance for the endpoint.
|
protected void |
initializeContainer(C instance)
Further initialize the specified container.
|
java.lang.Boolean |
isBatchListener()
Return true if this endpoint creates a batch listener.
|
void |
setAckDiscarded(java.lang.Boolean ackDiscarded)
Set to true to ack discards when a filter strategy is in use.
|
void |
setAfterRollbackProcessor(AfterRollbackProcessor<K,V> afterRollbackProcessor)
Set a processor to invoke after a transaction rollback; typically will
seek the unprocessed topic/partition to reprocess the records.
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
void |
setAutoStartup(java.lang.Boolean autoStartup)
Specify an
autoStartup boolean flag. |
void |
setBatchListener(java.lang.Boolean batchListener)
Set to true if this endpoint should create a batch listener.
|
void |
setConsumerFactory(ConsumerFactory<K,V> consumerFactory)
Specify a
ConsumerFactory to use. |
void |
setMessageConverter(MessageConverter messageConverter)
Set the message converter to use if dynamic argument type matching is needed.
|
void |
setPhase(int phase)
Specify a
phase to use. |
void |
setRecordFilterStrategy(RecordFilterStrategy<K,V> recordFilterStrategy)
Set the record filter strategy.
|
void |
setRecoveryCallback(org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
Set a callback to be used with the
retryTemplate. |
void |
setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
Set a retryTemplate.
|
public AbstractKafkaListenerContainerFactory()
public void setConsumerFactory(ConsumerFactory<K,V> consumerFactory)
ConsumerFactory to use.consumerFactory - The consumer factory.public ConsumerFactory<K,V> getConsumerFactory()
public void setAutoStartup(java.lang.Boolean autoStartup)
autoStartup boolean flag.autoStartup - true for auto startup.AbstractMessageListenerContainer.setAutoStartup(boolean)public void setPhase(int phase)
phase to use.phase - The phase.AbstractMessageListenerContainer.setPhase(int)public void setMessageConverter(MessageConverter messageConverter)
messageConverter - the converter.public void setRecordFilterStrategy(RecordFilterStrategy<K,V> recordFilterStrategy)
recordFilterStrategy - the strategy.public void setAckDiscarded(java.lang.Boolean ackDiscarded)
ackDiscarded - the ackDiscarded.public void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)
retryTemplate - the template.public void setRecoveryCallback(org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
retryTemplate.recoveryCallback - the callback.public java.lang.Boolean isBatchListener()
public void setBatchListener(java.lang.Boolean batchListener)
batchListener - true for a batch listener.public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic void setAfterRollbackProcessor(AfterRollbackProcessor<K,V> afterRollbackProcessor)
afterRollbackProcessor - the processor.public ContainerProperties getContainerProperties()
public C createListenerContainer(KafkaListenerEndpoint endpoint)
KafkaListenerContainerFactoryMessageListenerContainer for the given KafkaListenerEndpoint.createListenerContainer in interface KafkaListenerContainerFactory<C extends AbstractMessageListenerContainer<K,V>>endpoint - the endpoint to configureprotected abstract C createContainerInstance(KafkaListenerEndpoint endpoint)
endpoint - the endpoint.protected void initializeContainer(C instance)
Subclasses can inherit from this method to apply extra configuration if necessary.
instance - the container instance to configure.