addTopicPartition method

void addTopicPartition(
  1. String topicName,
  2. int partitionId,
  3. int time,
  4. int maxNumberOfOffsets,
)

Adds topic and partition to this requests.

time is used to ask for all messages before a certain time (ms). There are two special values:

  • Specify -1 to receive the latest offset (that is the offset of the next coming message).
  • Specify -2 to receive the earliest available offset.

maxNumberOfOffsets indicates max number of offsets to return.

Implementation

void addTopicPartition(String topicName, int partitionId, int time, int maxNumberOfOffsets) {
  if (_topics.containsKey(topicName) == false) {
    _topics[topicName] = [];
  }

  _topics[topicName]?.add(_PartitionOffsetRequestInfo(partitionId, time, maxNumberOfOffsets));
}