Google\Cloud\PubSub\V1\SubscriberClient::modifyPushConfig PHP Method

modifyPushConfig() public method

This may be used to change a push subscription to a pull one (signified by an empty PushConfig) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the PushConfig. Sample code: try { $subscriberClient = new SubscriberClient(); $formattedSubscription = SubscriberClient::formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]"); $pushConfig = new PushConfig(); $subscriberClient->modifyPushConfig($formattedSubscription, $pushConfig); } finally { if (isset($subscriberClient)) { $subscriberClient->close(); } }
public modifyPushConfig ( string $subscription, google\pubsub\v1\PushConfig $pushConfig, array $optionalArgs = [] )
$subscription string The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
$pushConfig google\pubsub\v1\PushConfig The push configuration for future deliveries. An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if `Pull` is not called.
$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. }
    public function modifyPushConfig($subscription, $pushConfig, $optionalArgs = [])
    {
        $request = new ModifyPushConfigRequest();
        $request->setSubscription($subscription);
        $request->setPushConfig($pushConfig);
        $mergedSettings = $this->defaultCallSettings['modifyPushConfig']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->subscriberStub, 'ModifyPushConfig', $mergedSettings, $this->descriptors['modifyPushConfig']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }