Interface TopicStatsClient (1.15.0)

public interface TopicStatsClient extends ApiBackgroundResource

Static Methods

create(TopicStatsClientSettings settings)

public static TopicStatsClient create(TopicStatsClientSettings settings)
Parameter
Name Description
settings TopicStatsClientSettings
Returns
Type Description
TopicStatsClient
Exceptions
Type Description
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
Name Description
path TopicPath

The topic to compute cursor for

partition Partition

The partition to compute cursor for

eventTime Timestamp

The target event time

Returns
Type Description
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
Name Description
path TopicPath

The topic to compute cursor for

partition Partition

The partition to compute cursor for

publishTime Timestamp

The target publish time

Returns
Type Description
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
Name Description
path TopicPath

The topic to compute head cursor on

partition Partition

The partition to compute head cursor for

Returns
Type Description
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
Name Description
path TopicPath

The topic to compute statistics on

partition Partition

The partition to compute statistics for

start Offset

The start cursor

end Offset

The end cursor

Returns
Type Description
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
Type Description
CloudRegion