getSnapshot method
Gets the configuration details of a snapshot. 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.
The snapshot
name can be just the simple name or it can be the fully
quantified name in the format: projects/{project}/snapshots/{snap}
.
Implementation
Future<Snapshot> getSnapshot({
int retries = 5,
required String snapshot,
}) async {
assert(_initialized);
_logger.fine('[getSnapshot]: start -- [$snapshot]');
try {
return await _execute(
executor: () async {
final result = await _pubsubApi.projects.snapshots.get(
snapshot.startsWith('projects/')
? snapshot
: 'projects/$_projectId/snapshots/$snapshot',
);
return result;
},
retries: retries,
);
} finally {
_logger.fine('[getSnapshot]: complete -- [$snapshot]');
}
}