Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Consumer (Properties) {

  // Subscribe to a list of topics, return immediately. 
   // Throws@throws anSubscriptionNotValidException exception if the new subscription is not valid with existing subscriptions.
  void subscribe(String...) throws SubscriptionNotValidException;

  // Subscribe to a specified topic partition, return immediately.
  // ThrowsNo angroup exceptionmanagement ifwill thebe newinvoked subscriptionif isspecific notpartitions valid with existing subscriptionsare specified.
  void void subscribe(String, Int);

  // Subscribe to a specified topic partition at the given offset, return immediately.
  // ThrowsNo angroup exceptionmanagement ifwill thebe newenvoked subscriptionif isspecific notpartitions valid with existing subscriptionsare specified.
  void void subscribe(String, Int, Long);

  // Try to fetch messages from the topic/partitions it subscribed to. 
  // Return whatever messages are available to be fetched or empty after specified timeout.
  List<Record> poll(Long) throws SubscriptionIsEmptyException, ConsumeInitOffsetNotKnownException;

  // Commit latest offsets for all partitions currently consuming from.
  // If the sync flag is set to true, commit call will be sync and blocking.
  // Otherwise the commit call will be async and best-effort.
  void commit(Boolean) throws SubscriptionIsEmptyException; 

  // Commit the specified offset for the specified topic/partition.
  // If the sync flag is set to true, commit call will be sync and blocking.
  // Otherwise the commit call will be async and best-effort.
  // Throws an exception if the group management has envoked and partitions specified are not currently consuming from.
  void commit(List[(String, Int, Long)], Boolean) throws InvalidPartitionsToCommitOffsetException;

  // Specify the fetch starting offset for the specified topic/partition.
  void posposition(List[(String, Int, Long)])

  // Get the currently consuming partitions.
  // Block wait if the current partitions are not known yet.
  List[(String, Int)] getPartitions() throws SubscriptionIsEmptyException;

  // Get the last committed offsets of the partitions currently consuming.
  // Block wait if the current partitions are not known yet.
  
   MapMap[(String, Int), Long] getOffsets() throws SubscriptionIsEmptyException, InvalidPartitionsToGetOffsetException, OffsetUnknownException;

  // Get the last committed offsets of the specified topic/partition.
  // Throws an exception if the group management has envoked and partitions specified  Longare not currently consuming from.
  Long getOffset(String, Int) throws SubscriptionIsEmptyException, InvalidPartitionsToGetOffsetException;
  
  // --------- Call-back Below, not part of API ------------ //

  // Call-back function upon partition de-assignment.
  // Default implementation will commit offset depending on auto.commit config.
  void onPartitionDeassigned(List[(String, Int)]);

  // Call-back function upon partition re-assignment.
  // Default implementation is No-Op will fetch starting offset depending on auto.commit config.
  void onPartitionAssigned(List[(String, Int)])
}

...