Class KafkaConsumerProperties

java.lang.Object
org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties

public class KafkaConsumerProperties extends Object
Extended consumer properties for Kafka binder.
Author:
Marius Bogoevici, Ilayaperumal Gopinathan, Soby Chacko, Gary Russell, Aldo Sinanaj

Thanks to Laszlo Szabo for providing the initial patch for generic property support.

  • Constructor Details

    • KafkaConsumerProperties

      public KafkaConsumerProperties()
  • Method Details

    • isAckEachRecord

      @Deprecated public boolean isAckEachRecord()
      Deprecated.
      since 3.1 in favor of using ackMode
      Returns:
      if each record needs to be acknowledged. When true the offset is committed after each record, otherwise the offsets for the complete set of records received from the poll() are committed after all records have been processed.
    • setAckEachRecord

      @Deprecated public void setAckEachRecord(boolean ackEachRecord)
      Deprecated.
      in favor of using ackMode
      Parameters:
      ackEachRecord -
    • isAutoCommitOffset

      @Deprecated public boolean isAutoCommitOffset()
      Deprecated.
      since 3.1 in favor of using ackMode
      Returns:
      is autocommit offset enabled Whether to autocommit offsets when a message has been processed. If set to false, a header with the key kafka_acknowledgment of the type org.springframework.kafka.support.Acknowledgment header is present in the inbound message. Applications may use this header for acknowledging messages.
    • setAutoCommitOffset

      @Deprecated public void setAutoCommitOffset(boolean autoCommitOffset)
      Deprecated.
      in favor of using ackMode
      Parameters:
      autoCommitOffset -
    • getAckMode

      public org.springframework.kafka.listener.ContainerProperties.AckMode getAckMode()
      Returns:
      Container's ack mode.
    • setAckMode

      public void setAckMode(org.springframework.kafka.listener.ContainerProperties.AckMode ackMode)
    • getStartOffset

      public KafkaConsumerProperties.StartOffset getStartOffset()
      Returns:
      start offset The starting offset for new groups. Allowed values: earliest and latest.
    • setStartOffset

      public void setStartOffset(KafkaConsumerProperties.StartOffset startOffset)
    • isResetOffsets

      public boolean isResetOffsets()
      Returns:
      if resetting offset is enabled Whether to reset offsets on the consumer to the value provided by startOffset. Must be false if a KafkaRebalanceListener is provided.
    • setResetOffsets

      public void setResetOffsets(boolean resetOffsets)
    • isEnableDlq

      public boolean isEnableDlq()
      Returns:
      is DLQ enabled. When set to true, it enables DLQ behavior for the consumer. By default, messages that result in errors are forwarded to a topic named error.name-of-destination.name-of-group. The DLQ topic name can be configurable by setting the dlqName property.
    • setEnableDlq

      public void setEnableDlq(boolean enableDlq)
    • getAutoCommitOnError

      public Boolean getAutoCommitOnError()
      Returns:
      is autocommit on error in polled consumers. This property accessor is only used in polled consumers.
    • setAutoCommitOnError

      public void setAutoCommitOnError(Boolean autoCommitOnError)
      Parameters:
      autoCommitOnError - commit on error in polled consumers.
    • getRecoveryInterval

      @Deprecated public int getRecoveryInterval()
      Deprecated.
      No longer used by the binder
      No longer used.
      Returns:
      the interval.
    • setRecoveryInterval

      @Deprecated public void setRecoveryInterval(int recoveryInterval)
      Deprecated.
      No longer needed by the binder
      No longer used.
      Parameters:
      recoveryInterval - the interval.
    • isAutoRebalanceEnabled

      public boolean isAutoRebalanceEnabled()
      Returns:
      is auto rebalance enabled When true, topic partitions is automatically rebalanced between the members of a consumer group. When false, each consumer is assigned a fixed set of partitions based on spring.cloud.stream.instanceCount and spring.cloud.stream.instanceIndex.
    • setAutoRebalanceEnabled

      public void setAutoRebalanceEnabled(boolean autoRebalanceEnabled)
    • getConfiguration

      public Map<String,String> getConfiguration()
      Returns:
      a map of configuration Map with a key/value pair containing generic Kafka consumer properties. In addition to having Kafka consumer properties, other configuration properties can be passed here.
    • setConfiguration

      public void setConfiguration(Map<String,String> configuration)
    • getDlqName

      public String getDlqName()
      Returns:
      dlq name The name of the DLQ topic to receive the error messages.
    • setDlqName

      public void setDlqName(String dlqName)
    • getDlqPartitions

      public Integer getDlqPartitions()
      Returns:
      number of partitions on the DLQ topic Number of partitions to use on the DLQ.
    • setDlqPartitions

      public void setDlqPartitions(Integer dlqPartitions)
    • getTrustedPackages

      public String[] getTrustedPackages()
      Returns:
      trusted packages List of trusted packages to provide the header mapper.
    • setTrustedPackages

      public void setTrustedPackages(String[] trustedPackages)
    • getDlqProducerProperties

      public KafkaProducerProperties getDlqProducerProperties()
      Returns:
      dlq producer properties Using this, DLQ-specific producer properties can be set. All the properties available through kafka producer properties can be set through this property.
    • setDlqProducerProperties

      public void setDlqProducerProperties(KafkaProducerProperties dlqProducerProperties)
    • getStandardHeaders

      public KafkaConsumerProperties.StandardHeaders getStandardHeaders()
      Returns:
      standard headers Indicates which standard headers are populated by the inbound channel adapter. Allowed values: none, id, timestamp, or both.
    • setStandardHeaders

      public void setStandardHeaders(KafkaConsumerProperties.StandardHeaders standardHeaders)
    • getConverterBeanName

      public String getConverterBeanName()
      Returns:
      converter bean name The name of a bean that implements RecordMessageConverter.
    • setConverterBeanName

      public void setConverterBeanName(String converterBeanName)
    • getIdleEventInterval

      public long getIdleEventInterval()
      Returns:
      idle event interval The interval, in milliseconds, between events indicating that no messages have recently been received.
    • setIdleEventInterval

      public void setIdleEventInterval(long idleEventInterval)
    • isDestinationIsPattern

      public boolean isDestinationIsPattern()
      Returns:
      is destination given through a pattern When true, the destination is treated as a regular expression Pattern used to match topic names by the broker.
    • setDestinationIsPattern

      public void setDestinationIsPattern(boolean destinationIsPattern)
    • getTopic

      public KafkaTopicProperties getTopic()
      Returns:
      topic properties Various topic level properties. @see KafkaTopicProperties for more details.
    • setTopic

      public void setTopic(KafkaTopicProperties topic)
    • getPollTimeout

      public long getPollTimeout()
      Returns:
      timeout in pollable consumers Timeout used for polling in pollable consumers.
    • setPollTimeout

      public void setPollTimeout(long pollTimeout)
    • getTransactionManager

      public String getTransactionManager()
      Returns:
      the transaction manager bean name. Transaction manager bean name (must be KafkaAwareTransactionManager.
    • setTransactionManager

      public void setTransactionManager(String transactionManager)
    • isTxCommitRecovered

      public boolean isTxCommitRecovered()
    • setTxCommitRecovered

      public void setTxCommitRecovered(boolean txCommitRecovered)
    • getCommonErrorHandlerBeanName

      public String getCommonErrorHandlerBeanName()
    • setCommonErrorHandlerBeanName

      public void setCommonErrorHandlerBeanName(String commonErrorHandlerBeanName)