1.16.5 (latest) 1.16.2 1.15.21 1.14.8 1.13.8 1.12.22 1.11.2 1.10.0 1.9.4 1.8.0 1.7.1 1.6.3 1.5.5 1.4.12

    public class TopicStatsClientImpl extends ApiResourceAggregation implements TopicStatsClient

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [ApiResourceAggregation](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation) \> TopicStatsClientImpl

## Implements

[TopicStatsClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.TopicStatsClient)

## Inherited Members

[ApiResourceAggregation.awaitTermination(long,TimeUnit)](https://docs.cloud.google.com/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_) [ApiResourceAggregation.close()](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_close__) [ApiResourceAggregation.isShutdown()](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_isShutdown__) [ApiResourceAggregation.isTerminated()](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_isTerminated__) [ApiResourceAggregation.shutdown()](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_shutdown__) [ApiResourceAggregation.shutdownNow()](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.ApiResourceAggregation#com_google_cloud_pubsublite_internal_ApiResourceAggregation_shutdownNow__) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)

    public TopicStatsClientImpl(CloudRegion region, TopicStatsServiceClient serviceClient)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `region` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.CloudRegion` |
| `serviceClient` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.v1.TopicStatsServiceClient` |

## Methods

### computeCursorForEventTime(TopicPath path, Partition partition, Timestamp eventTime)

    public ApiFuture<Optional<Cursor>> computeCursorForEventTime(TopicPath path, Partition partition, Timestamp eventTime)

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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `path` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.TopicPath` |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` |
| `eventTime` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.proto.Cursor>>` |   |

### computeCursorForPublishTime(TopicPath path, Partition partition, Timestamp publishTime)

    public ApiFuture<Optional<Cursor>> computeCursorForPublishTime(TopicPath path, Partition partition, Timestamp publishTime)

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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `path` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.TopicPath` |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` |
| `publishTime` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.proto.Cursor>>` |   |

### computeHeadCursor(TopicPath path, Partition partition)

    public ApiFuture<Cursor> computeHeadCursor(TopicPath path, Partition partition)

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.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `path` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.TopicPath` |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.proto.Cursor>` |   |

### computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)

    public ApiFuture<ComputeMessageStatsResponse> computeMessageStats(TopicPath path, Partition partition, Offset start, Offset end)

Compute statistics about the messages between two cursors in a topic partition.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `path` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.TopicPath` |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` |
| `start` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Offset` |
| `end` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Offset` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/api-common/latest/com.google.api.core.ApiFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.proto.ComputeMessageStatsResponse>` |   |

### region()

    public CloudRegion region()

The Google Cloud region this client operates on.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.CloudRegion` |   |