Class KafkaConsumerProperties
java.lang.Object
org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Standard headers for the message.static enum
Enumeration for starting consumer offset. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.kafka.listener.ContainerProperties.AckMode
long
long
int
Deprecated.No longer used by the bindergetTopic()
String[]
boolean
Deprecated.since 3.1 in favor of usingackMode
boolean
Deprecated.since 3.1 in favor of usingackMode
boolean
boolean
boolean
boolean
boolean
void
setAckEachRecord
(boolean ackEachRecord) Deprecated.in favor of usingackMode
void
setAckMode
(org.springframework.kafka.listener.ContainerProperties.AckMode ackMode) void
setAutoCommitOffset
(boolean autoCommitOffset) Deprecated.in favor of usingackMode
void
setAutoCommitOnError
(Boolean autoCommitOnError) void
setAutoRebalanceEnabled
(boolean autoRebalanceEnabled) void
setCommonErrorHandlerBeanName
(String commonErrorHandlerBeanName) void
setConfiguration
(Map<String, String> configuration) void
setConverterBeanName
(String converterBeanName) void
setDestinationIsPattern
(boolean destinationIsPattern) void
setDlqName
(String dlqName) void
setDlqPartitions
(Integer dlqPartitions) void
setDlqProducerProperties
(KafkaProducerProperties dlqProducerProperties) void
setEnableDlq
(boolean enableDlq) void
setIdleEventInterval
(long idleEventInterval) void
setPollTimeout
(long pollTimeout) void
setRecoveryInterval
(int recoveryInterval) Deprecated.No longer needed by the bindervoid
setResetOffsets
(boolean resetOffsets) void
setStandardHeaders
(KafkaConsumerProperties.StandardHeaders standardHeaders) void
setStartOffset
(KafkaConsumerProperties.StartOffset startOffset) void
setTopic
(KafkaTopicProperties topic) void
setTransactionManager
(String transactionManager) void
setTrustedPackages
(String[] trustedPackages) void
setTxCommitRecovered
(boolean txCommitRecovered)
-
Constructor Details
-
KafkaConsumerProperties
public KafkaConsumerProperties()
-
-
Method Details
-
isAckEachRecord
Deprecated.since 3.1 in favor of usingackMode
- 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.in favor of usingackMode
- Parameters:
ackEachRecord
-
-
isAutoCommitOffset
Deprecated.since 3.1 in favor of usingackMode
- 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.in favor of usingackMode
- 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
- Returns:
- start offset The starting offset for new groups. Allowed values: earliest and latest.
-
setStartOffset
-
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
- Returns:
- is autocommit on error in polled consumers. This property accessor is only used in polled consumers.
-
setAutoCommitOnError
- Parameters:
autoCommitOnError
- commit on error in polled consumers.
-
getRecoveryInterval
Deprecated.No longer used by the binderNo longer used.- Returns:
- the interval.
-
setRecoveryInterval
Deprecated.No longer needed by the binderNo 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
- 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
-
getDlqName
- Returns:
- dlq name The name of the DLQ topic to receive the error messages.
-
setDlqName
-
getDlqPartitions
- Returns:
- number of partitions on the DLQ topic Number of partitions to use on the DLQ.
-
setDlqPartitions
-
getTrustedPackages
- Returns:
- trusted packages List of trusted packages to provide the header mapper.
-
setTrustedPackages
-
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
-
getStandardHeaders
- Returns:
- standard headers Indicates which standard headers are populated by the inbound channel adapter. Allowed values: none, id, timestamp, or both.
-
setStandardHeaders
-
getConverterBeanName
- Returns:
- converter bean name The name of a bean that implements RecordMessageConverter.
-
setConverterBeanName
-
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
- Returns:
- topic properties
Various topic level properties. @see
KafkaTopicProperties
for more details.
-
setTopic
-
getPollTimeout
public long getPollTimeout()- Returns:
- timeout in pollable consumers Timeout used for polling in pollable consumers.
-
setPollTimeout
public void setPollTimeout(long pollTimeout) -
getTransactionManager
- Returns:
- the transaction manager bean name.
Transaction manager bean name (must be
KafkaAwareTransactionManager
.
-
setTransactionManager
-
isTxCommitRecovered
public boolean isTxCommitRecovered() -
setTxCommitRecovered
public void setTxCommitRecovered(boolean txCommitRecovered) -
getCommonErrorHandlerBeanName
-
setCommonErrorHandlerBeanName
-