listTopicSnapshots method

Future<ListTopicSnapshotsResponse> listTopicSnapshots({
  1. int? pageSize,
  2. String? pageToken,
  3. int retries = 5,
  4. required String topic,
})

Lists the names of the snapshots on this topic. 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 topic can be just the simple name or it can be the fully quantified name in the format: projects/{project}/topics/{topic}.

Implementation

Future<ListTopicSnapshotsResponse> listTopicSnapshots({
  int? pageSize,
  String? pageToken,
  int retries = 5,
  required String topic,
}) async {
  assert(_initialized);
  _logger.fine('[listTopicSnapshots]: start -- [$topic]');
  try {
    return await _execute(
      executor: () async {
        final result = await _pubsubApi.projects.topics.snapshots.list(
          topic.startsWith('projects/')
              ? topic
              : 'projects/$_projectId/topics/$topic',
          pageSize: pageSize,
          pageToken: pageToken,
        );

        return result;
      },
      retries: retries,
    );
  } finally {
    _logger.fine('[listTopicSnapshots]: complete -- [$topic]');
  }
}