Class KafkaMessageDrivenChannelAdapterSpec<K,V,S extends KafkaMessageDrivenChannelAdapterSpec<K,V,S>>
java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<T>
org.springframework.integration.dsl.IntegrationComponentSpec<S,P>
org.springframework.integration.dsl.MessageProducerSpec<S,KafkaMessageDrivenChannelAdapter<K,V>>
org.springframework.integration.kafka.dsl.KafkaMessageDrivenChannelAdapterSpec<K,V,S>
- Type Parameters:
K- the key type.V- the value type.S- the targetKafkaMessageDrivenChannelAdapterSpecimplementation type.
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,DisposableBean,FactoryBean<KafkaMessageDrivenChannelAdapter<K,V>>,InitializingBean,Lifecycle,Phased,SmartLifecycle,ComponentsRegistration
- Direct Known Subclasses:
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec
public class KafkaMessageDrivenChannelAdapterSpec<K,V,S extends KafkaMessageDrivenChannelAdapterSpec<K,V,S>> extends MessageProducerSpec<S,KafkaMessageDrivenChannelAdapter<K,V>> implements ComponentsRegistration
A
MessageProducerSpec implementation for the KafkaMessageDrivenChannelAdapter.- Since:
- 5.4
- Author:
- Artem Bilan, Gary Russell, Cameron Mayfield
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,V>AConcurrentMessageListenerContainerconfigurationKafkaMessageDrivenChannelAdapterSpecextension. -
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
PARSER, target -
Method Summary
Modifier and Type Method Description SackDiscarded(boolean ackDiscarded)Abooleanflag to indicate ifFilteringMessageListenerAdaptershould acknowledge discarded records or not.SbatchMessageConverter(org.springframework.kafka.support.converter.BatchMessageConverter messageConverter)Set the message converter to use with a batch-based consumer.SfilterInRetry(boolean filterInRetry)Thebooleanflag to specify the order howRetryingMessageListenerAdapterandFilteringMessageListenerAdapterare wrapped to each other, if both of them are present.Map<Object,String>getComponentsToRegister()SmessageConverter(org.springframework.kafka.support.converter.MessageConverter messageConverter)Set the message converter; must be aRecordMessageConverterorBatchMessageConverterdepending on mode.SonPartitionsAssignedSeekCallback(BiConsumer<Map<org.apache.kafka.common.TopicPartition,Long>,org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)Specify aBiConsumerfor seeks management duringConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)call from theKafkaMessageListenerContainer.SpayloadType(Class<?> payloadType)When using a type-aware message converter (such asStringJsonMessageConverter, set the payload type the converter should create.SrecordFilterStrategy(org.springframework.kafka.listener.adapter.RecordFilterStrategy<K,V> recordFilterStrategy)Specify aRecordFilterStrategyto wrapKafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListenerintoFilteringMessageListenerAdapter.SrecordMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)Set the message converter to use with a record-based consumer.SrecoveryCallback(org.springframework.retry.RecoveryCallback<?> recoveryCallback)ARecoveryCallbackinstance for retry operation; if null, the exception will be thrown to the container after retries are exhausted.SretryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate)Specify aRetryTemplateinstance to wrapKafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListenerintoRetryingMessageListenerAdapter.Methods inherited from class org.springframework.integration.dsl.MessageProducerSpec
autoStartup, errorChannel, errorChannel, errorMessageStrategy, id, outputChannel, outputChannel, phase, sendTimeout, shouldTrackMethods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stopMethods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Method Details
-
messageConverter
public S messageConverter(org.springframework.kafka.support.converter.MessageConverter messageConverter)Set the message converter; must be aRecordMessageConverterorBatchMessageConverterdepending on mode.- Parameters:
messageConverter- the converter.- Returns:
- the spec
-
recordMessageConverter
public S recordMessageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)Set the message converter to use with a record-based consumer.- Parameters:
messageConverter- the converter.- Returns:
- the spec
-
batchMessageConverter
public S batchMessageConverter(org.springframework.kafka.support.converter.BatchMessageConverter messageConverter)Set the message converter to use with a batch-based consumer.- Parameters:
messageConverter- the converter.- Returns:
- the spec
-
recordFilterStrategy
public S recordFilterStrategy(org.springframework.kafka.listener.adapter.RecordFilterStrategy<K,V> recordFilterStrategy)Specify aRecordFilterStrategyto wrapKafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListenerintoFilteringMessageListenerAdapter.- Parameters:
recordFilterStrategy- theRecordFilterStrategyto use.- Returns:
- the spec
-
ackDiscarded
Abooleanflag to indicate ifFilteringMessageListenerAdaptershould acknowledge discarded records or not. Does not make sense ifrecordFilterStrategy(RecordFilterStrategy)isn't specified.- Parameters:
ackDiscarded- true to ack (commit offset for) discarded messages.- Returns:
- the spec
-
retryTemplate
Specify aRetryTemplateinstance to wrapKafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListenerintoRetryingMessageListenerAdapter.- Parameters:
retryTemplate- theRetryTemplateto use.- Returns:
- the spec
-
recoveryCallback
ARecoveryCallbackinstance for retry operation; if null, the exception will be thrown to the container after retries are exhausted. Does not make sense ifretryTemplate(RetryTemplate)isn't specified.- Parameters:
recoveryCallback- the recovery callback.- Returns:
- the spec
-
payloadType
When using a type-aware message converter (such asStringJsonMessageConverter, set the payload type the converter should create. Defaults toObject.- Parameters:
payloadType- the type.- Returns:
- the spec
-
filterInRetry
Thebooleanflag to specify the order howRetryingMessageListenerAdapterandFilteringMessageListenerAdapterare wrapped to each other, if both of them are present. Does not make sense if only one ofRetryTemplateorRecordFilterStrategyis present, or any.- Parameters:
filterInRetry- the order forRetryingMessageListenerAdapterandFilteringMessageListenerAdapterwrapping. Defaults tofalse.- Returns:
- the spec
-
onPartitionsAssignedSeekCallback
public S onPartitionsAssignedSeekCallback(BiConsumer<Map<org.apache.kafka.common.TopicPartition,Long>,org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)Specify aBiConsumerfor seeks management duringConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback)call from theKafkaMessageListenerContainer.- Parameters:
onPartitionsAssignedCallback- theBiConsumerto use- Returns:
- the spec
-
getComponentsToRegister
- Specified by:
getComponentsToRegisterin interfaceComponentsRegistration
-