Google\Cloud\PubSub\V1\SubscriberClient::acknowledge PHP 메소드

acknowledge() 공개 메소드

Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error. Sample code: try { $subscriberClient = new SubscriberClient(); $formattedSubscription = SubscriberClient::formatSubscriptionName("[PROJECT]", "[SUBSCRIPTION]"); $ackIds = []; $subscriberClient->acknowledge($formattedSubscription, $ackIds); } finally { if (isset($subscriberClient)) { $subscriberClient->close(); } }
public acknowledge ( string $subscription, string[] $ackIds, array $optionalArgs = [] )
$subscription string The subscription whose message is being acknowledged. Format is `projects/{project}/subscriptions/{sub}`.
$ackIds string[] The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the `Pull` response. Must not be empty.
$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 acknowledge($subscription, $ackIds, $optionalArgs = [])
    {
        $request = new AcknowledgeRequest();
        $request->setSubscription($subscription);
        foreach ($ackIds as $elem) {
            $request->addAckIds($elem);
        }
        $mergedSettings = $this->defaultCallSettings['acknowledge']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->subscriberStub, 'Acknowledge', $mergedSettings, $this->descriptors['acknowledge']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }