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 interface TopicStatsClient extends ApiBackgroundResource

## Implements

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

## Static Methods

### create(TopicStatsClientSettings settings)

    public static TopicStatsClient create(TopicStatsClientSettings settings)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `settings` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.internal.TopicStatsClientSettings` |

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

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html` |   |

## Methods

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

    public abstract 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` The topic to compute cursor for |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` The partition to compute cursor for |
| `eventTime` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` The target event time |

| **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>>` | A future that will have either an error [ApiException](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html), an empty Optional or a non-null [Cursor](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 abstract 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` The topic to compute cursor for |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` The partition to compute cursor for |
| `publishTime` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` The target publish time |

| **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>>` | A future that will have either an error [ApiException](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html), an empty Optional or a non-null [Cursor](https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.proto.Cursor). |

### computeHeadCursor(TopicPath path, Partition partition)

    public abstract 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` The topic to compute head cursor on |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` The partition to compute head cursor for |

| **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>` | A future that will have either an error [ApiException](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html) or the head cursor on success. |

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

    public abstract 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` The topic to compute statistics on |
| `partition` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Partition` The partition to compute statistics for |
| `start` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Offset` The start cursor |
| `end` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-pubsublite/latest/com.google.cloud.pubsublite.Offset` The end cursor |

| **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>` | A future that will have either an error [ApiException](https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.rpc.ApiException.html) or the ComputeMessageStatistics on success. |

### region()

    public abstract 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` |   |