modifyAckDeadline() public method

public modifyAckDeadline ( array $args )
$args array
示例#1
0
 /**
  * Set the acknowledge deadline for multiple ackIds.
  *
  * Use {@see Google\Cloud\PubSub\Subscription::modifyAckDeadline()} to
  * modify the ack deadline for a single message.
  *
  * Example:
  * ```
  * $subscription = $pubsub->subscription('my-new-subscription');
  * $messages = $subscription->pull();
  *
  * $ackIds = [];
  * foreach ($messages as $message) {
  *     $ackIds[] = $message['ackId'];
  * }
  *
  * // Set the ack deadline to a minute and a half from now for every message
  * $subscription->modifyAckDeadlineBatch($ackIds, 90);
  *
  * // Delay execution, or make a sandwich or something.
  * sleep(80);
  *
  * // Now we'll acknowledge
  * $subscription->acknowledge($ackIds);
  * ```
  *
  * @codingStandardsIgnoreStart
  * @see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/modifyAckDeadline Modify Ack Deadline
  * @codingStandardsIgnoreEnd
  *
  * @param string $ackIds List of acknowledgment IDs.
  * @param int $seconds 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.
  * @param array $options [optional] Configuration Options
  * @return void
  */
 public function modifyAckDeadlineBatch(array $ackIds, $seconds, array $options = [])
 {
     $this->connection->modifyAckDeadline($options + ['subscription' => $this->name, 'ackIds' => $ackIds, 'ackDeadlineSeconds' => $seconds]);
 }
 /**
  * Set the acknowledge deadline for multiple ackIds.
  *
  * 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);
  * ```
  *
  * @codingStandardsIgnoreStart
  * @see https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions/modifyAckDeadline Modify Ack Deadline
  * @codingStandardsIgnoreEnd
  *
  * @param Message[] $messages An array of messages
  * @param int $seconds 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.
  * @param array $options [optional] Configuration Options
  * @return void
  */
 public function modifyAckDeadlineBatch(array $messages, $seconds, array $options = [])
 {
     $this->validateBatch($messages, Message::class);
     $this->connection->modifyAckDeadline($options + ['subscription' => $this->name, 'ackIds' => $this->getMessageAckIds($messages), 'ackDeadlineSeconds' => $seconds]);
 }