Compute the cursor of the first message with event time greater than or equal to the specified
event time, for a topic partition. If messages are missing an event time, the publish time is
used as a fallback. As event times are user supplied, subsequent messages may have event times
less than the specified event time and should be filtered by the client, if necessary.
If such a message cannot be found, the returned Optional will be empty.
Compute the cursor of the first message with publish time greater than or equal to the
specified publish time, for a topic partition. All messages thereafter are guaranteed to have
publish times greater than or equal to the specified publish time.
If such a message cannot be found, the returned Optional will be empty.
Compute the head cursor for the partition. The head cursor's offset is guaranteed to be before
or equal to all messages which have not yet been acknowledged to be published, and greater than
the offset of any message whose publish has already been acknowledged. It is 0 if there have
never been messages on the partition.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class TopicStatsClientImpl (1.15.13)\n\nVersion latestkeyboard_arrow_down\n\n- [1.15.13 (latest)](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.15.12](/java/docs/reference/google-cloud-pubsublite/1.15.12/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.14.8](/java/docs/reference/google-cloud-pubsublite/1.14.8/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.13.8](/java/docs/reference/google-cloud-pubsublite/1.13.8/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.12.22](/java/docs/reference/google-cloud-pubsublite/1.12.22/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.11.2](/java/docs/reference/google-cloud-pubsublite/1.11.2/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.10.0](/java/docs/reference/google-cloud-pubsublite/1.10.0/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.9.4](/java/docs/reference/google-cloud-pubsublite/1.9.4/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.8.0](/java/docs/reference/google-cloud-pubsublite/1.8.0/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.7.1](/java/docs/reference/google-cloud-pubsublite/1.7.1/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.6.3](/java/docs/reference/google-cloud-pubsublite/1.6.3/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.5.5](/java/docs/reference/google-cloud-pubsublite/1.5.5/com.google.cloud.pubsublite.internal.TopicStatsClientImpl)\n- [1.4.12](/java/docs/reference/google-cloud-pubsublite/1.4.12/com.google.cloud.pubsublite.internal.TopicStatsClientImpl) \n\n public class TopicStatsClientImpl extends ApiResourceAggregation implements TopicStatsClient\n\nInheritance\n-----------\n\n[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \\\u003e [ApiResourceAggregation](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation) \\\u003e TopicStatsClientImpl \n\nImplements\n----------\n\n[TopicStatsClient](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.TopicStatsClient) \n\nInherited Members\n-----------------\n\n[ApiResourceAggregation.awaitTermination(long,TimeUnit)](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_awaitTermination_long_java_util_concurrent_TimeUnit_) \n[ApiResourceAggregation.close()](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_close__) \n[ApiResourceAggregation.isShutdown()](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_isShutdown__) \n[ApiResourceAggregation.isTerminated()](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_isTerminated__) \n[ApiResourceAggregation.shutdown()](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_shutdown__) \n[ApiResourceAggregation.shutdownNow()](/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_shutdownNow__) \n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)\n\nConstructors\n------------\n\n### TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)\n\n public TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)\n\nMethods\n-------\n\n### computeCursorForEventTime(TopicPath path, Partition partition, Timestamp eventTime)\n\n public ApiFuture\u003cOptional\u003cCursor\u003e\u003e computeCursorForEventTime(TopicPath path, Partition partition, Timestamp eventTime)\n\nCompute the cursor of the first message with event time greater than or equal to the specified\nevent time, for a topic partition. If messages are missing an event time, the publish time is\nused as a fallback. As event times are user supplied, subsequent messages may have event times\nless than the specified event time and should be filtered by the client, if necessary.\n\nIf such a message cannot be found, the returned Optional will be empty.\n\n### computeCursorForPublishTime(TopicPath path, Partition partition, Timestamp publishTime)\n\n public ApiFuture\u003cOptional\u003cCursor\u003e\u003e computeCursorForPublishTime(TopicPath path, Partition partition, Timestamp publishTime)\n\nCompute the cursor of the first message with publish time greater than or equal to the\nspecified publish time, for a topic partition. All messages thereafter are guaranteed to have\npublish times greater than or equal to the specified publish time.\n\nIf such a message cannot be found, the returned Optional will be empty.\n\n### computeHeadCursor(TopicPath path, Partition partition)\n\n public ApiFuture\u003cCursor\u003e computeHeadCursor(TopicPath path, Partition partition)\n\nCompute the head cursor for the partition. The head cursor's offset is guaranteed to be before\nor equal to all messages which have not yet been acknowledged to be published, and greater than\nthe offset of any message whose publish has already been acknowledged. It is 0 if there have\nnever been messages on the partition.\n\n### computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)\n\n public ApiFuture\u003cComputeMessageStatsResponse\u003e computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)\n\nCompute statistics about the messages between two cursors in a topic partition.\n\n### region()\n\n public CloudRegion region()\n\nThe Google Cloud region this client operates on."]]