Interface TopicStatsClient (1.8.0)

public interface TopicStatsClient extends ApiBackgroundResource

Static Methods

create(TopicStatsClientSettings settings)

public static TopicStatsClient create(TopicStatsClientSettings settings)
Parameter
NameDescription
settingsTopicStatsClientSettings
Returns
TypeDescription
TopicStatsClient
Exceptions
TypeDescription
ApiException

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
NameDescription
pathTopicPath

The topic to compute cursor for

partitionPartition

The partition to compute cursor for

eventTimeTimestamp

The target event time

Returns
TypeDescription
ApiFuture<Optional<Cursor>>

A future that will have either an error ApiException, an empty Optional or a non-null 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
NameDescription
pathTopicPath

The topic to compute cursor for

partitionPartition

The partition to compute cursor for

publishTimeTimestamp

The target publish time

Returns
TypeDescription
ApiFuture<Optional<Cursor>>

A future that will have either an error ApiException, an empty Optional or a non-null 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
NameDescription
pathTopicPath

The topic to compute head cursor on

partitionPartition

The partition to compute head cursor for

Returns
TypeDescription
ApiFuture<Cursor>

A future that will have either an error ApiException 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
NameDescription
pathTopicPath

The topic to compute statistics on

partitionPartition

The partition to compute statistics for

startOffset

The start cursor

endOffset

The end cursor

Returns
TypeDescription
ApiFuture<ComputeMessageStatsResponse>

A future that will have either an error ApiException or the ComputeMessageStatistics on success.

region()

public abstract CloudRegion region()

The Google Cloud region this client operates on.

Returns
TypeDescription
CloudRegion