Google\Cloud\PubSub\V1\PublisherClient::getTopic PHP Method

getTopic() public method

Sample code: try { $publisherClient = new PublisherClient(); $formattedTopic = PublisherClient::formatTopicName("[PROJECT]", "[TOPIC]"); $response = $publisherClient->getTopic($formattedTopic); } finally { if (isset($publisherClient)) { $publisherClient->close(); } }
public getTopic ( string $topic, array $optionalArgs = [] ) : google\pubsub\v1\Topic
$topic string The name of the topic to get. Format is `projects/{project}/topics/{topic}`.
$optionalArgs array { Optional. @type \Google\GAX\RetrySettings $retrySettings Retry settings to use for this call. If present, then $timeoutMillis is ignored. @type int $timeoutMillis Timeout to use for this call. Only used if $retrySettings is not set. }
return google\pubsub\v1\Topic
    public function getTopic($topic, $optionalArgs = [])
    {
        $request = new GetTopicRequest();
        $request->setTopic($topic);
        $mergedSettings = $this->defaultCallSettings['getTopic']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->publisherStub, 'GetTopic', $mergedSettings, $this->descriptors['getTopic']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }