Class KafkaProducerProperties

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

public class KafkaProducerProperties extends Object
Extended producer properties for Kafka binder.
Author:
Marius Bogoevici, Henryk Konsek, Gary Russell, Aldo Sinanaj
  • Constructor Details

    • KafkaProducerProperties

      public KafkaProducerProperties()
  • Method Details

    • getBufferSize

      public int getBufferSize()
      Returns:
      buffer size Upper limit, in bytes, of how much data the Kafka producer attempts to batch before sending.
    • setBufferSize

      public void setBufferSize(int bufferSize)
    • getCompressionType

      @NotNull public @NotNull KafkaProducerProperties.CompressionType getCompressionType()
      Returns:
      compression type KafkaProducerProperties.CompressionType Set the compression.type producer property. Supported values are none, gzip, snappy, lz4 and zstd. See KafkaProducerProperties.CompressionType for more details.
    • setCompressionType

      public void setCompressionType(KafkaProducerProperties.CompressionType compressionType)
    • isSync

      public boolean isSync()
      Returns:
      if synchronous sending is enabled Whether the producer is synchronous.
    • setSync

      public void setSync(boolean sync)
    • getSendTimeoutExpression

      public org.springframework.expression.Expression getSendTimeoutExpression()
      Returns:
      timeout expression for send A SpEL expression evaluated against the outgoing message used to evaluate the time to wait for ack when synchronous publish is enabled.
    • setSendTimeoutExpression

      public void setSendTimeoutExpression(org.springframework.expression.Expression sendTimeoutExpression)
    • getBatchTimeout

      public int getBatchTimeout()
      Returns:
      batch timeout How long the producer waits to allow more messages to accumulate in the same batch before sending the messages.
    • setBatchTimeout

      public void setBatchTimeout(int batchTimeout)
    • getMessageKeyExpression

      public org.springframework.expression.Expression getMessageKeyExpression()
      Returns:
      message key expression A SpEL expression evaluated against the outgoing message used to populate the key of the produced Kafka message.
    • setMessageKeyExpression

      public void setMessageKeyExpression(org.springframework.expression.Expression messageKeyExpression)
    • getHeaderPatterns

      public String[] getHeaderPatterns()
      Returns:
      header patterns A comma-delimited list of simple patterns to match Spring messaging headers to be mapped to the Kafka Headers in the ProducerRecord.
    • setHeaderPatterns

      public void setHeaderPatterns(String[] headerPatterns)
    • getConfiguration

      public Map<String,String> getConfiguration()
      Returns:
      map of configuration Map with a key/value pair containing generic Kafka producer properties.
    • setConfiguration

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

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

      public void setTopic(KafkaTopicProperties topic)
    • isUseTopicHeader

      public boolean isUseTopicHeader()
      Returns:
      if using topic header Set to true to override the default binding destination (topic name) with the value of the KafkaHeaders.TOPIC message header in the outbound message. If the header is not present, the default binding destination is used.
    • setUseTopicHeader

      public void setUseTopicHeader(boolean useTopicHeader)
    • getRecordMetadataChannel

      public String getRecordMetadataChannel()
      Returns:
      record metadata channel The bean name of a MessageChannel to which successful send results should be sent; the bean must exist in the application context.
    • setRecordMetadataChannel

      public void setRecordMetadataChannel(String recordMetadataChannel)
    • getTransactionManager

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

      public void setTransactionManager(String transactionManager)
    • getCloseTimeout

      public int getCloseTimeout()
    • setCloseTimeout

      public void setCloseTimeout(int closeTimeout)
    • isAllowNonTransactional

      public boolean isAllowNonTransactional()
    • setAllowNonTransactional

      public void setAllowNonTransactional(boolean allowNonTransactional)