use of io.confluent.kafkarest.entities.v2.TopicPartitionOffsetResponse in project kafka-rest by confluentinc.
the class PartitionsResource method getOffsets.
/**
* Returns a summary with beginning and end offsets for the given {@code topic} and {@code
* partition}.
*
* @throws io.confluent.rest.exceptions.RestNotFoundException if either {@code topic} or {@code
* partition} don't exist.
*/
@GET
@Path("/{partition}/offsets")
@ResourceName("api.v2.partitions.get-offsets")
public void getOffsets(@Suspended AsyncResponse asyncResponse, @PathParam("topic") String topic, @PathParam("partition") int partitionId) {
CompletableFuture<TopicPartitionOffsetResponse> response = partitionManager.get().getLocalPartition(topic, partitionId).thenApply(partition -> partition.orElseThrow(Errors::partitionNotFoundException)).thenApply(partition -> new TopicPartitionOffsetResponse(partition.getEarliestOffset(), partition.getLatestOffset()));
AsyncResponses.asyncResume(asyncResponse, response);
}
Aggregations