getTopic method

Future<Topic> getTopic({
  1. int retries = 5,
  2. required String topic,
})

Gets the configuration of a topic. The name of the topic can be the simple name or it can be the fully quantified format: projects/{project}/topics/{topic}.

Implementation

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

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