Package org.springframework.cloud.task.batch.autoconfigure.kafka

# 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
  Constructor
  Description
  `KafkaItemReaderProperties()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the configured value of the name used to calculate `ExecutionContext` keys.
  `List<Integer>`
  `getPartitions()`
  A list of partitions to manually assign to the consumer.
  `long`
  `getPollTimeOutInSeconds()`
  Get the pollTimeout for the poll() operations.
  `String`
  `getTopic()`
  Returns the name of the topic from which messages will be read.
  `boolean`
  `isSaveState()`
  Configure if the state of the `ItemStreamSupport` should be persisted within the `ExecutionContext` for restart purposes.
  `void`
  `setName(String name)`
  The name used to calculate the key within the `ExecutionContext`.
  `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 the `ItemStreamSupport` should be persisted within the `ExecutionContext` for restart purposes.
  `void`
  `setTopic(String topic)`
  The topic name from which the messages will be read.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### KafkaItemReaderProperties

    public KafkaItemReaderProperties()

- ## Method Details

  - ### getName

    public String getName()
    Returns the configured value of the name used to calculate `ExecutionContext` keys.
    Returns:
      the name

  - ### setName

    public void setName(String name)
    The name used to calculate the key within the `ExecutionContext`.
    Parameters:
      `name` - name of the writer instance
    See Also:
      - `ItemStreamSupport.setName(String)`

  - ### getTopic

    public String getTopic()
    Returns the name of the topic from which messages will be read.
    Returns:
      the name of the topic.

  - ### setTopic

    public void setTopic(String topic)
    The topic name from which the messages will be read.
    Parameters:
      `topic` - name of the topic

  - ### getPartitions

    public List<Integer> 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

    public void setPartitions(List<Integer> partitions)
    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 the `ItemStreamSupport` should be persisted within the `ExecutionContext` for restart purposes. Defaults to true.
    Returns:
      current status of the saveState flag.

  - ### setSaveState

    public void setSaveState(boolean saveState)
    Configure if the state of the `ItemStreamSupport` should be persisted within the `ExecutionContext` for restart purposes.
    Parameters:
      `saveState` - true if state should be persisted. Defaults to true.