modifyAckDeadlineBatch() public method

Use {@see \Google\Cloud\PubSub\Subscription::modifyAckDeadline()} to modify the ack deadline for a single message. Example: $messages = $subscription->pull(); $messagesArray = iterator_to_array($messages); Set the ack deadline to a minute and a half from now for every message $subscription->modifyAckDeadlineBatch($messagesArray, 3); Delay execution, or make a sandwich or something. sleep(2); Now we'll acknowledge $subscription->acknowledge($messagesArray);
See also: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/modifyAckDeadline Modify Ack Deadline
public modifyAckDeadlineBatch ( array $messages, integer $seconds, array $options = [] ) : void
$messages array An array of messages
$seconds integer The new ack deadline with respect to the time this request was sent to the Pub/Sub system. Must be >= 0. For example, if the value is 10, the new ack deadline will expire 10 seconds after the ModifyAckDeadline call was made. Specifying zero may immediately make the message available for another pull request.
$options array [optional] Configuration Options
return void
 public function testModifyAckDeadlineBatch()
 {
     $ackIds = ['foobar', 'otherAckId'];
     $seconds = 100;
     $this->connection->modifyAckDeadline(Argument::that(function ($args) use($ackIds, $seconds) {
         if ($args['foo'] !== 'bar') {
             return false;
         }
         if ($args['ackIds'] !== $ackIds) {
             return false;
         }
         if ($args['ackDeadlineSeconds'] !== $seconds) {
             return false;
         }
         return true;
     }))->shouldBeCalledTimes(1);
     $subscription = new Subscription($this->connection->reveal(), 'subscription-name', 'topic-name', 'project-id');
     $subscription->modifyAckDeadlineBatch($ackIds, $seconds, ['foo' => 'bar']);
 }