Class KafkaProducerProperties
java.lang.Object
org.springframework.cloud.stream.binder.kafka.properties.KafkaProducerProperties
Extended producer properties for Kafka binder.
- Author:
- Marius Bogoevici, Henryk Konsek, Gary Russell, Aldo Sinanaj
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration for compression types. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
int
int
String[]
org.springframework.expression.Expression
org.springframework.expression.Expression
getTopic()
boolean
boolean
isSync()
boolean
void
setAllowNonTransactional
(boolean allowNonTransactional) void
setBatchTimeout
(int batchTimeout) void
setBufferSize
(int bufferSize) void
setCloseTimeout
(int closeTimeout) void
setCompressionType
(KafkaProducerProperties.CompressionType compressionType) void
setConfiguration
(Map<String, String> configuration) void
setHeaderPatterns
(String[] headerPatterns) void
setMessageKeyExpression
(org.springframework.expression.Expression messageKeyExpression) void
setRecordMetadataChannel
(String recordMetadataChannel) void
setSendTimeoutExpression
(org.springframework.expression.Expression sendTimeoutExpression) void
setSync
(boolean sync) void
setTopic
(KafkaTopicProperties topic) void
setTransactionManager
(String transactionManager) void
setUseTopicHeader
(boolean useTopicHeader)
-
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
- Returns:
- compression type
KafkaProducerProperties.CompressionType
Set the compression.type producer property. Supported values are none, gzip, snappy, lz4 and zstd. SeeKafkaProducerProperties.CompressionType
for more details.
-
setCompressionType
-
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
- 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
-
getConfiguration
- Returns:
- map of configuration Map with a key/value pair containing generic Kafka producer properties.
-
setConfiguration
-
getTopic
- Returns:
- topic properties
Various topic level properties. @see
KafkaTopicProperties
for more details.
-
setTopic
-
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
- 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
-
getTransactionManager
- Returns:
- the transaction manager bean name.
Transaction manager bean name (must be
KafkaAwareTransactionManager
.
-
setTransactionManager
-
getCloseTimeout
public int getCloseTimeout() -
setCloseTimeout
public void setCloseTimeout(int closeTimeout) -
isAllowNonTransactional
public boolean isAllowNonTransactional() -
setAllowNonTransactional
public void setAllowNonTransactional(boolean allowNonTransactional)
-