acknowledge() public method

Use {@see \Google\Cloud\PubSub\Subscription::acknowledgeBatch()} to acknowledge multiple messages at once. Example: $messages = $subscription->pull(); $messagesArray = iterator_to_array($messages); $subscription->acknowledge($messagesArray[0]);
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/acknowledge Acknowledge Message
public acknowledge ( Message $message, array $options = [] ) : void
$message Message A message object.
$options array [optional] Configuration Options
return void
 public function testAcknowledge()
 {
     $ackId = 'foobar';
     $this->connection->acknowledge(Argument::that(function ($args) use($ackId) {
         if ($args['foo'] !== 'bar') {
             return false;
         }
         if ($args['ackIds'] !== [$ackId]) {
             return false;
         }
         return true;
     }))->shouldBeCalledTimes(1);
     $subscription = new Subscription($this->connection->reveal(), 'subscription-name', 'topic-name', 'project-id');
     $subscription->acknowledge($ackId, ['foo' => 'bar']);
 }