seek method
Seeks an existing subscription to a point in time or to a given snapshot,
whichever is provided in the request. Snapshots are used in Seek
operations, which allow you to manage message acknowledgments in bulk.
That is, you can set the acknowledgment state of messages in an existing
subscription to the state captured by a snapshot. Note that both the
subscription and the snapshot must be on the same topic.
The subscription
name can be just the simple name or it can be the fully
quantified name in the format:
projects/{project}/subscriptions/{subscription}
.
Implementation
Future<SeekResponse> seek({
required int maxMessages,
int retries = 5,
required String subscription,
}) async {
assert(_initialized);
_logger.fine('[seek]: start -- [$subscription]');
try {
return await _execute(
executor: () async {
final result = await _pubsubApi.projects.subscriptions.seek(
SeekRequest(),
subscription.startsWith('projects/')
? subscription
: 'projects/$_projectId/subscriptions/$subscription',
);
return result;
},
retries: retries,
);
} finally {
_logger.fine('[seek]: complete -- [$subscription]');
}
}