Class KafkaItemReaderProperties
java.lang.Object
org.springframework.cloud.task.batch.autoconfigure.kafka.KafkaItemReaderProperties
@ConfigurationProperties(prefix="spring.batch.job.kafkaitemreader")
public class KafkaItemReaderProperties
extends Object
Properties to configure a
KafkaItemReader.- Since:
- 2.3
- Author:
- Glenn Renfro
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Returns the configured value of the name used to calculateExecutionContextkeys.A list of partitions to manually assign to the consumer.longGet the pollTimeout for the poll() operations.getTopic()Returns the name of the topic from which messages will be read.booleanConfigure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.voidThe name used to calculate the key within theExecutionContext.voidsetPartitions(List<Integer> partitions) A list of partitions to manually assign to the consumer.voidsetPollTimeOutInSeconds(long pollTimeOutInSeconds) Set the pollTimeout for the poll() operations.voidsetSaveState(boolean saveState) Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.voidThe topic name from which the messages will be read.
-
Constructor Details
-
KafkaItemReaderProperties
public KafkaItemReaderProperties()
-
-
Method Details
-
getName
Returns the configured value of the name used to calculateExecutionContextkeys.- Returns:
- the name
-
setName
The name used to calculate the key within theExecutionContext.- Parameters:
name- name of the writer instance- See Also:
-
ItemStreamSupport.setName(String)
-
getTopic
Returns the name of the topic from which messages will be read.- Returns:
- the name of the topic.
-
setTopic
The topic name from which the messages will be read.- Parameters:
topic- name of the topic
-
getPartitions
A list of partitions to manually assign to the consumer. Defaults to a single entry value of 1.- Returns:
- the list of partitions.
-
setPartitions
A list of partitions to manually assign to the consumer. Defaults to a single entry value of 1.- Parameters:
partitions- list of partitions
-
getPollTimeOutInSeconds
public long getPollTimeOutInSeconds()Get the pollTimeout for the poll() operations. Defaults to 30 seconds.- Returns:
- long containing the poll timeout.
-
setPollTimeOutInSeconds
public void setPollTimeOutInSeconds(long pollTimeOutInSeconds) Set the pollTimeout for the poll() operations. Defaults to 30 seconds.- Parameters:
pollTimeOutInSeconds- the number of seconds to wait before timing out.
-
isSaveState
public boolean isSaveState()Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes. Defaults to true.- Returns:
- current status of the saveState flag.
-
setSaveState
public void setSaveState(boolean saveState) Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- Parameters:
saveState- true if state should be persisted. Defaults to true.
-