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

listTopicSubscriptions() public method

Sample code: try { $publisherClient = new PublisherClient(); $formattedTopic = PublisherClient::formatTopicName("[PROJECT]", "[TOPIC]"); foreach ($publisherClient->listTopicSubscriptions($formattedTopic) as $element) { doThingsWith(element); } } finally { if (isset($publisherClient)) { $publisherClient->close(); } }
public listTopicSubscriptions ( string $topic, array $optionalArgs = [] ) : Google\GAX\PagedListResponse
$topic string The name of the topic that subscriptions are attached to. Format is `projects/{project}/topics/{topic}`.
$optionalArgs array { Optional. @type int $pageSize The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved. @type string $pageToken A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API. @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\GAX\PagedListResponse
    public function listTopicSubscriptions($topic, $optionalArgs = [])
    {
        $request = new ListTopicSubscriptionsRequest();
        $request->setTopic($topic);
        if (isset($optionalArgs['pageSize'])) {
            $request->setPageSize($optionalArgs['pageSize']);
        }
        if (isset($optionalArgs['pageToken'])) {
            $request->setPageToken($optionalArgs['pageToken']);
        }
        $mergedSettings = $this->defaultCallSettings['listTopicSubscriptions']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->publisherStub, 'ListTopicSubscriptions', $mergedSettings, $this->descriptors['listTopicSubscriptions']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }