Class KafkaTemplateSpec<K,V>

java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<KafkaTemplateSpec<K,V>, org.springframework.kafka.core.KafkaTemplate<K,V>>
org.springframework.integration.kafka.dsl.KafkaTemplateSpec<K,V>
Type Parameters:
K - the key type.
V - the value type.
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.FactoryBean<org.springframework.kafka.core.KafkaTemplate<K,V>>, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
KafkaOutboundGatewaySpec.ReplyingKafkaTemplateSpec

public class KafkaTemplateSpec<K,V> extends org.springframework.integration.dsl.IntegrationComponentSpec<KafkaTemplateSpec<K,V>, org.springframework.kafka.core.KafkaTemplate<K,V>>
An IntegrationComponentSpec implementation for the KafkaTemplate.
Since:
5.4
  • Field Summary

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

    logger, PARSER, target

    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
    defaultTopic(String defaultTopic)
    /** Set the default topic for send methods where a topic is not providing.
    org.springframework.kafka.core.KafkaTemplate<K,V>
     
    id(String id)
     
    messageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
    Set the message converter to use.
    producerListener(org.springframework.kafka.support.ProducerListener<K,V> producerListener)
    Set a ProducerListener which will be invoked when Kafka acknowledges a send operation.

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

    _this, afterPropertiesSet, destroy, doGet, getId, getObject, getObjectType, getPhase, isAutoStartup, isRunning, start, stop, stop

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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

    isSingleton

    Methods inherited from interface org.springframework.context.SmartLifecycle

    isPauseable, pause, restart
  • Method Details

    • getTemplate

      public org.springframework.kafka.core.KafkaTemplate<K,V> getTemplate()
    • id

      public KafkaTemplateSpec<K,V> id(String id)
      Overrides:
      id in class org.springframework.integration.dsl.IntegrationComponentSpec<KafkaTemplateSpec<K,V>, org.springframework.kafka.core.KafkaTemplate<K,V>>
    • defaultTopic

      public KafkaTemplateSpec<K,V> defaultTopic(String defaultTopic)
      /** Set the default topic for send methods where a topic is not providing.
      Parameters:
      defaultTopic - the topic.
      Returns:
      the spec
    • producerListener

      public KafkaTemplateSpec<K,V> producerListener(org.springframework.kafka.support.ProducerListener<K,V> producerListener)
      Set a ProducerListener which will be invoked when Kafka acknowledges a send operation. By default a LoggingProducerListener is configured which logs errors only.
      Parameters:
      producerListener - the listener; may be null.
      Returns:
      the spec
    • messageConverter

      public KafkaTemplateSpec<K,V> messageConverter(org.springframework.kafka.support.converter.RecordMessageConverter messageConverter)
      Set the message converter to use.
      Parameters:
      messageConverter - the message converter.
      Returns:
      the spec