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 target KafkaMessageDrivenChannelAdapterSpec implementation type.
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<KafkaMessageDrivenChannelAdapter<K,​V>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.integration.dsl.ComponentsRegistration
Direct Known Subclasses:
KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec

public class KafkaMessageDrivenChannelAdapterSpec<K,​V,​S extends KafkaMessageDrivenChannelAdapterSpec<K,​V,​S>>
extends org.springframework.integration.dsl.MessageProducerSpec<S,​KafkaMessageDrivenChannelAdapter<K,​V>>
implements org.springframework.integration.dsl.ComponentsRegistration
A MessageProducerSpec implementation for the KafkaMessageDrivenChannelAdapter.
Since:
5.4
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  KafkaMessageDrivenChannelAdapterSpec.KafkaMessageDrivenChannelAdapterListenerContainerSpec<K,​V>
    A ConcurrentMessageListenerContainer configuration KafkaMessageDrivenChannelAdapterSpec extension.
  • Field Summary

    Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    PARSER, target

    Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    logger

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE

    Fields inherited from interface org.springframework.context.SmartLifecycle

    DEFAULT_PHASE
  • Method Summary

    Modifier and Type Method Description
    S ackDiscarded​(boolean ackDiscarded)
    A boolean flag to indicate if FilteringMessageListenerAdapter should acknowledge discarded records or not.
    S batchMessageConverter​(org.springframework.kafka.support.converter.BatchMessageConverter messageConverter)
    Set the message converter to use with a batch-based consumer.
    S filterInRetry​(boolean filterInRetry)
    The boolean flag to specify the order how RetryingMessageListenerAdapter and FilteringMessageListenerAdapter are wrapped to each other, if both of them are present.
    java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()  
    S messageConverter​(org.springframework.kafka.support.converter.MessageConverter messageConverter)
    Set the message converter; must be a RecordMessageConverter or BatchMessageConverter depending on mode.
    S onPartitionsAssignedSeekCallback​(java.util.function.BiConsumer<java.util.Map<org.apache.kafka.common.TopicPartition,​java.lang.Long>,​org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)
    Specify a BiConsumer for seeks management during ConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback) call from the KafkaMessageListenerContainer.
    S payloadType​(java.lang.Class<?> payloadType)
    When using a type-aware message converter (such as StringJsonMessageConverter, set the payload type the converter should create.
    S recordFilterStrategy​(org.springframework.kafka.listener.adapter.RecordFilterStrategy<K,​V> recordFilterStrategy)
    Specify a RecordFilterStrategy to wrap KafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListener into FilteringMessageListenerAdapter.
    S recordMessageConverter​(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
    Set the message converter to use with a record-based consumer.
    S recoveryCallback​(org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
    A RecoveryCallback instance for retry operation; if null, the exception will be thrown to the container after retries are exhausted.
    S retryTemplate​(org.springframework.retry.support.RetryTemplate retryTemplate)
    Specify a RetryTemplate instance to wrap KafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListener into RetryingMessageListenerAdapter.

    Methods inherited from class org.springframework.integration.dsl.MessageProducerSpec

    autoStartup, errorChannel, errorChannel, errorMessageStrategy, id, outputChannel, outputChannel, phase, sendTimeout, shouldTrack

    Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec

    _this, createInstance, destroyInstance, doGet, get, getId, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • messageConverter

      public S messageConverter​(org.springframework.kafka.support.converter.MessageConverter messageConverter)
      Set the message converter; must be a RecordMessageConverter or BatchMessageConverter depending 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 a RecordFilterStrategy to wrap KafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListener into FilteringMessageListenerAdapter.
      Parameters:
      recordFilterStrategy - the RecordFilterStrategy to use.
      Returns:
      the spec
    • ackDiscarded

      public S ackDiscarded​(boolean ackDiscarded)
      A boolean flag to indicate if FilteringMessageListenerAdapter should acknowledge discarded records or not. Does not make sense if recordFilterStrategy(RecordFilterStrategy) isn't specified.
      Parameters:
      ackDiscarded - true to ack (commit offset for) discarded messages.
      Returns:
      the spec
    • retryTemplate

      public S retryTemplate​(org.springframework.retry.support.RetryTemplate retryTemplate)
      Specify a RetryTemplate instance to wrap KafkaMessageDrivenChannelAdapter.IntegrationRecordMessageListener into RetryingMessageListenerAdapter.
      Parameters:
      retryTemplate - the RetryTemplate to use.
      Returns:
      the spec
    • recoveryCallback

      public S recoveryCallback​(org.springframework.retry.RecoveryCallback<? extends java.lang.Object> recoveryCallback)
      A RecoveryCallback instance for retry operation; if null, the exception will be thrown to the container after retries are exhausted. Does not make sense if retryTemplate(RetryTemplate) isn't specified.
      Parameters:
      recoveryCallback - the recovery callback.
      Returns:
      the spec
    • payloadType

      public S payloadType​(java.lang.Class<?> payloadType)
      When using a type-aware message converter (such as StringJsonMessageConverter, set the payload type the converter should create. Defaults to Object.
      Parameters:
      payloadType - the type.
      Returns:
      the spec
      Since:
      3.2.0
    • filterInRetry

      public S filterInRetry​(boolean filterInRetry)
      The boolean flag to specify the order how RetryingMessageListenerAdapter and FilteringMessageListenerAdapter are wrapped to each other, if both of them are present. Does not make sense if only one of RetryTemplate or RecordFilterStrategy is present, or any.
      Parameters:
      filterInRetry - the order for RetryingMessageListenerAdapter and FilteringMessageListenerAdapter wrapping. Defaults to false.
      Returns:
      the spec
    • onPartitionsAssignedSeekCallback

      public S onPartitionsAssignedSeekCallback​(java.util.function.BiConsumer<java.util.Map<org.apache.kafka.common.TopicPartition,​java.lang.Long>,​org.springframework.kafka.listener.ConsumerSeekAware.ConsumerSeekCallback> onPartitionsAssignedCallback)
      Specify a BiConsumer for seeks management during ConsumerSeekAware.onPartitionsAssigned(Map, ConsumerSeekAware.ConsumerSeekCallback) call from the KafkaMessageListenerContainer.
      Parameters:
      onPartitionsAssignedCallback - the BiConsumer to use
      Returns:
      the spec
      Since:
      3.0.4
    • getComponentsToRegister

      public java.util.Map<java.lang.Object,​java.lang.String> getComponentsToRegister()
      Specified by:
      getComponentsToRegister in interface org.springframework.integration.dsl.ComponentsRegistration