Interface AsyncCheckpointConsumer<T>
- Type Parameters:
T- the type of message values
public interface AsyncCheckpointConsumer<T>
Asynchronous view of a
CheckpointConsumer.
All operations return CompletableFuture and never block.
Obtained via CheckpointConsumer.async().
-
Method Summary
Modifier and TypeMethodDescriptionCreate a consistent checkpoint asynchronously.close()Close this consumer asynchronously.receive()Receive a single message asynchronously.Receive a single message, completing withnullif the timeout elapses.receiveMulti(int maxMessages, Duration timeout) Receive a batch of messages asynchronously.
-
Method Details
-
receive
CompletableFuture<Message<T>> receive()Receive a single message asynchronously.- Returns:
- a
CompletableFuturethat completes with the next available message
-
receive
Receive a single message, completing withnullif the timeout elapses.- Parameters:
timeout- the maximum duration to wait for a message- Returns:
- a
CompletableFuturethat completes with the next available message, ornullif the timeout elapses
-
receiveMulti
Receive a batch of messages asynchronously.- Parameters:
maxMessages- maximum number of messages to returntimeout- maximum time to wait for messages- Returns:
- a
CompletableFuturethat completes with a list of up tomaxMessagesmessages
-
checkpoint
CompletableFuture<Checkpoint> checkpoint()Create a consistent checkpoint asynchronously.- Returns:
- a
CompletableFuturethat completes with aCheckpointrepresenting the current position across all segments of the topic
-
close
CompletableFuture<Void> close()Close this consumer asynchronously.- Returns:
- a
CompletableFuturethat completes when the consumer has been closed and all resources have been released
-