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
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Returns the configured value of the name used to calculateExecutionContext
keys.A list of partitions to manually assign to the consumer.long
Get the pollTimeout for the poll() operations.getTopic()
Returns the name of the topic from which messages will be read.boolean
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.void
The name used to calculate the key within theExecutionContext
.void
setPartitions
(List<Integer> partitions) A list of partitions to manually assign to the consumer.void
setPollTimeOutInSeconds
(long pollTimeOutInSeconds) Set the pollTimeout for the poll() operations.void
setSaveState
(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.void
The 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 calculateExecutionContext
keys.- 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 theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes. Defaults to true.- Returns:
- current status of the saveState flag.
-
setSaveState
public void setSaveState(boolean saveState) Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- Parameters:
saveState
- true if state should be persisted. Defaults to true.
-