Reference documentation and code samples for the Cloud PubSub V1 Client class SubscriberClient.
Service Description: The service that an application uses to manipulate subscriptions and to
consume messages from a subscription via the Pull
method or by
establishing a bi-directional stream using the StreamingPull
method.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.
Namespace
Google \ Cloud \ PubSub \ V1 \ ClientMethods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
options |
array
Optional. Options for configuring the service API wrapper. |
↳ apiEndpoint |
string
The address of the API remote host. May optionally include the port, formatted as "
|
↳ credentials |
string|array|FetchAuthTokenInterface|CredentialsWrapper
The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. |
↳ credentialsConfig |
array
Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() . |
↳ disableRetries |
bool
Determines whether or not retries defined by the client configuration should be disabled. Defaults to |
↳ clientConfig |
string|array
Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder. |
↳ transport |
string|TransportInterface
The transport used for executing network requests. May be either the string |
↳ transportConfig |
array
Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options. |
↳ clientCertSource |
callable
A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS. |
acknowledge
Acknowledges the messages associated with the ack_ids
in the
AcknowledgeRequest
. The Pub/Sub system can remove the relevant messages
from the subscription.
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.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::acknowledgeAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\AcknowledgeRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\AcknowledgeRequest;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
/**
* @param string $formattedSubscription The subscription whose message is being acknowledged.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
* @param string $ackIdsElement The acknowledgment ID for the messages being acknowledged that
* was returned by the Pub/Sub system in the `Pull` response. Must not be
* empty.
*/
function acknowledge_sample(string $formattedSubscription, string $ackIdsElement): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$ackIds = [$ackIdsElement,];
$request = (new AcknowledgeRequest())
->setSubscription($formattedSubscription)
->setAckIds($ackIds);
// Call the API and handle any network failures.
try {
$subscriberClient->acknowledge($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
$ackIdsElement = '[ACK_IDS]';
acknowledge_sample($formattedSubscription, $ackIdsElement);
}
createSnapshot
Creates a snapshot from the requested subscription. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
If the snapshot already exists, returns ALREADY_EXISTS
.
If the requested subscription doesn't exist, returns NOT_FOUND
.
If the backlog in the subscription is too old -- and the resulting snapshot
would expire in less than 1 hour -- then FAILED_PRECONDITION
is returned.
See also the Snapshot.expire_time
field. If the name is not provided in
the request, the server will assign a random
name for this snapshot on the same project as the subscription, conforming
to the resource name format. The
generated name is populated in the returned Snapshot object. Note that for
REST API requests, you must specify a name in the request.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::createSnapshotAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\CreateSnapshotRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Snapshot |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\CreateSnapshotRequest;
use Google\Cloud\PubSub\V1\Snapshot;
/**
* @param string $formattedName User-provided name for this snapshot. If the name is not provided
* in the request, the server will assign a random name for this snapshot on
* the same project as the subscription. Note that for REST API requests, you
* must specify a name. See the [resource name
* rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
* Format is `projects/{project}/snapshots/{snap}`. Please see
* {@see SubscriberClient::snapshotName()} for help formatting this field.
* @param string $formattedSubscription The subscription whose backlog the snapshot retains.
* Specifically, the created snapshot is guaranteed to retain:
* (a) The existing backlog on the subscription. More precisely, this is
* defined as the messages in the subscription's backlog that are
* unacknowledged upon the successful completion of the
* `CreateSnapshot` request; as well as:
* (b) Any messages published to the subscription's topic following the
* successful completion of the CreateSnapshot request.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
*/
function create_snapshot_sample(string $formattedName, string $formattedSubscription): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new CreateSnapshotRequest())
->setName($formattedName)
->setSubscription($formattedSubscription);
// Call the API and handle any network failures.
try {
/** @var Snapshot $response */
$response = $subscriberClient->createSnapshot($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedName = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]');
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
create_snapshot_sample($formattedName, $formattedSubscription);
}
createSubscription
Creates a subscription to a given topic. See the resource name rules.
If the subscription already exists, returns ALREADY_EXISTS
.
If the corresponding topic doesn't exist, returns NOT_FOUND
.
If the name is not provided in the request, the server will assign a random name for this subscription on the same project as the topic, conforming to the resource name format. The generated name is populated in the returned Subscription object. Note that for REST API requests, you must specify a name in the request.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::createSubscriptionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\Subscription
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Subscription |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\Subscription;
/**
* @param string $name The name of the subscription. It must have the format
* `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
* start with a letter, and contain only letters (`[A-Za-z]`), numbers
* (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
* plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
* in length, and it must not start with `"goog"`.
* @param string $formattedTopic The name of the topic from which this subscription is receiving
* messages. Format is `projects/{project}/topics/{topic}`. The value of this
* field will be `_deleted-topic_` if the topic has been deleted. Please see
* {@see SubscriberClient::topicName()} for help formatting this field.
*/
function create_subscription_sample(string $name, string $formattedTopic): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new Subscription())
->setName($name)
->setTopic($formattedTopic);
// Call the API and handle any network failures.
try {
/** @var Subscription $response */
$response = $subscriberClient->createSubscription($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$name = '[NAME]';
$formattedTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]');
create_subscription_sample($name, $formattedTopic);
}
deleteSnapshot
Removes an existing snapshot. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
When the snapshot is deleted, all messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new one may be created with the same name, but the new one has no association with the old snapshot or its subscription, unless the same subscription is specified.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::deleteSnapshotAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\DeleteSnapshotRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\DeleteSnapshotRequest;
/**
* @param string $formattedSnapshot The name of the snapshot to delete.
* Format is `projects/{project}/snapshots/{snap}`. Please see
* {@see SubscriberClient::snapshotName()} for help formatting this field.
*/
function delete_snapshot_sample(string $formattedSnapshot): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new DeleteSnapshotRequest())
->setSnapshot($formattedSnapshot);
// Call the API and handle any network failures.
try {
$subscriberClient->deleteSnapshot($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]');
delete_snapshot_sample($formattedSnapshot);
}
deleteSubscription
Deletes an existing subscription. All messages retained in the subscription
are immediately dropped. Calls to Pull
after deletion will return
NOT_FOUND
. After a subscription is deleted, a new one may be created with
the same name, but the new one has no association with the old
subscription or its topic unless the same topic is specified.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::deleteSubscriptionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\DeleteSubscriptionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\DeleteSubscriptionRequest;
/**
* @param string $formattedSubscription The subscription to delete.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
*/
function delete_subscription_sample(string $formattedSubscription): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new DeleteSubscriptionRequest())
->setSubscription($formattedSubscription);
// Call the API and handle any network failures.
try {
$subscriberClient->deleteSubscription($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
delete_subscription_sample($formattedSubscription);
}
getSnapshot
Gets the configuration details of a snapshot. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::getSnapshotAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\GetSnapshotRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Snapshot |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\GetSnapshotRequest;
use Google\Cloud\PubSub\V1\Snapshot;
/**
* @param string $formattedSnapshot The name of the snapshot to get.
* Format is `projects/{project}/snapshots/{snap}`. Please see
* {@see SubscriberClient::snapshotName()} for help formatting this field.
*/
function get_snapshot_sample(string $formattedSnapshot): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new GetSnapshotRequest())
->setSnapshot($formattedSnapshot);
// Call the API and handle any network failures.
try {
/** @var Snapshot $response */
$response = $subscriberClient->getSnapshot($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSnapshot = SubscriberClient::snapshotName('[PROJECT]', '[SNAPSHOT]');
get_snapshot_sample($formattedSnapshot);
}
getSubscription
Gets the configuration details of a subscription.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::getSubscriptionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\GetSubscriptionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Subscription |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\GetSubscriptionRequest;
use Google\Cloud\PubSub\V1\Subscription;
/**
* @param string $formattedSubscription The name of the subscription to get.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
*/
function get_subscription_sample(string $formattedSubscription): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new GetSubscriptionRequest())
->setSubscription($formattedSubscription);
// Call the API and handle any network failures.
try {
/** @var Subscription $response */
$response = $subscriberClient->getSubscription($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
get_subscription_sample($formattedSubscription);
}
listSnapshots
Lists the existing snapshots. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::listSnapshotsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ListSnapshotsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\ListSnapshotsRequest;
use Google\Cloud\PubSub\V1\Snapshot;
/**
* @param string $formattedProject The name of the project in which to list snapshots.
* Format is `projects/{project-id}`. Please see
* {@see SubscriberClient::projectName()} for help formatting this field.
*/
function list_snapshots_sample(string $formattedProject): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new ListSnapshotsRequest())
->setProject($formattedProject);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $subscriberClient->listSnapshots($request);
/** @var Snapshot $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedProject = SubscriberClient::projectName('[PROJECT]');
list_snapshots_sample($formattedProject);
}
listSubscriptions
Lists matching subscriptions.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::listSubscriptionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ListSubscriptionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\ListSubscriptionsRequest;
use Google\Cloud\PubSub\V1\Subscription;
/**
* @param string $formattedProject The name of the project in which to list subscriptions.
* Format is `projects/{project-id}`. Please see
* {@see SubscriberClient::projectName()} for help formatting this field.
*/
function list_subscriptions_sample(string $formattedProject): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new ListSubscriptionsRequest())
->setProject($formattedProject);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $subscriberClient->listSubscriptions($request);
/** @var Subscription $element */
foreach ($response as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedProject = SubscriberClient::projectName('[PROJECT]');
list_subscriptions_sample($formattedProject);
}
modifyAckDeadline
Modifies the ack deadline for a specific message. This method is useful
to indicate that more time is needed to process a message by the
subscriber, or to make the message available for redelivery if the
processing was interrupted. Note that this does not modify the
subscription-level ackDeadlineSeconds
used for subsequent messages.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::modifyAckDeadlineAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ModifyAckDeadlineRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\ModifyAckDeadlineRequest;
/**
* @param string $formattedSubscription The name of the subscription.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
* @param string $ackIdsElement List of acknowledgment IDs.
* @param int $ackDeadlineSeconds The new ack deadline with respect to the time this request was
* sent to the Pub/Sub system. For example, if the value is 10, the new ack
* deadline will expire 10 seconds after the `ModifyAckDeadline` call was
* made. Specifying zero might immediately make the message available for
* delivery to another subscriber client. This typically results in an
* increase in the rate of message redeliveries (that is, duplicates).
* The minimum deadline you can specify is 0 seconds.
* The maximum deadline you can specify in a single request is 600 seconds
* (10 minutes).
*/
function modify_ack_deadline_sample(
string $formattedSubscription,
string $ackIdsElement,
int $ackDeadlineSeconds
): void {
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$ackIds = [$ackIdsElement,];
$request = (new ModifyAckDeadlineRequest())
->setSubscription($formattedSubscription)
->setAckIds($ackIds)
->setAckDeadlineSeconds($ackDeadlineSeconds);
// Call the API and handle any network failures.
try {
$subscriberClient->modifyAckDeadline($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
$ackIdsElement = '[ACK_IDS]';
$ackDeadlineSeconds = 0;
modify_ack_deadline_sample($formattedSubscription, $ackIdsElement, $ackDeadlineSeconds);
}
modifyPushConfig
Modifies the PushConfig
for a specified subscription.
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
.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::modifyPushConfigAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ModifyPushConfigRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\ModifyPushConfigRequest;
use Google\Cloud\PubSub\V1\PushConfig;
/**
* @param string $formattedSubscription The name of the subscription.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
*/
function modify_push_config_sample(string $formattedSubscription): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$pushConfig = new PushConfig();
$request = (new ModifyPushConfigRequest())
->setSubscription($formattedSubscription)
->setPushConfig($pushConfig);
// Call the API and handle any network failures.
try {
$subscriberClient->modifyPushConfig($request);
printf('Call completed successfully.' . PHP_EOL);
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
modify_push_config_sample($formattedSubscription);
}
pull
Pulls messages from the server.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::pullAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\PullRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\PullResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\PullRequest;
use Google\Cloud\PubSub\V1\PullResponse;
/**
* @param string $formattedSubscription The subscription from which messages should be pulled.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
* @param int $maxMessages The maximum number of messages to return for this request. Must
* be a positive integer. The Pub/Sub system may return fewer than the number
* specified.
*/
function pull_sample(string $formattedSubscription, int $maxMessages): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new PullRequest())
->setSubscription($formattedSubscription)
->setMaxMessages($maxMessages);
// Call the API and handle any network failures.
try {
/** @var PullResponse $response */
$response = $subscriberClient->pull($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
$maxMessages = 0;
pull_sample($formattedSubscription, $maxMessages);
}
seek
Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot. Note that both the subscription and the snapshot must be on the same topic.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::seekAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\SeekRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\SeekResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\SeekRequest;
use Google\Cloud\PubSub\V1\SeekResponse;
/**
* @param string $formattedSubscription The subscription to affect. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
*/
function seek_sample(string $formattedSubscription): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new SeekRequest())
->setSubscription($formattedSubscription);
// Call the API and handle any network failures.
try {
/** @var SeekResponse $response */
$response = $subscriberClient->seek($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
seek_sample($formattedSubscription);
}
streamingPull
Establishes a stream with the server, which sends messages down to the
client. The client streams acknowledgements and ack deadline modifications
back to the server. The server will close the stream and return the status
on any error. The server may close the stream with status UNAVAILABLE
to
reassign server-side resources, in which case, the client should
re-establish the stream. Flow control can be achieved by configuring the
underlying RPC channel.
Parameters | |
---|---|
Name | Description |
callOptions |
array
Optional. |
↳ timeoutMillis |
int
Timeout to use for this call. |
Returns | |
---|---|
Type | Description |
Google\ApiCore\BidiStream |
use Google\ApiCore\ApiException;
use Google\ApiCore\BidiStream;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\StreamingPullRequest;
use Google\Cloud\PubSub\V1\StreamingPullResponse;
/**
* @param string $formattedSubscription The subscription for which to initialize the new stream. This
* must be provided in the first request on the stream, and must not be set in
* subsequent requests from client to server.
* Format is `projects/{project}/subscriptions/{sub}`. Please see
* {@see SubscriberClient::subscriptionName()} for help formatting this field.
* @param int $streamAckDeadlineSeconds The ack deadline to use for the stream. This must be provided in
* the first request on the stream, but it can also be updated on subsequent
* requests from client to server. The minimum deadline you can specify is 10
* seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
*/
function streaming_pull_sample(string $formattedSubscription, int $streamAckDeadlineSeconds): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new StreamingPullRequest())
->setSubscription($formattedSubscription)
->setStreamAckDeadlineSeconds($streamAckDeadlineSeconds);
// Call the API and handle any network failures.
try {
/** @var BidiStream $stream */
$stream = $subscriberClient->streamingPull();
$stream->writeAll([$request,]);
/** @var StreamingPullResponse $element */
foreach ($stream->closeWriteAndReadAll() as $element) {
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
}
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedSubscription = SubscriberClient::subscriptionName('[PROJECT]', '[SUBSCRIPTION]');
$streamAckDeadlineSeconds = 0;
streaming_pull_sample($formattedSubscription, $streamAckDeadlineSeconds);
}
updateSnapshot
Updates an existing snapshot by updating the fields specified in the update mask. Snapshots are used in Seek operations, which allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in an existing subscription to the state captured by a snapshot.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::updateSnapshotAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\UpdateSnapshotRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Snapshot |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\Snapshot;
use Google\Cloud\PubSub\V1\UpdateSnapshotRequest;
use Google\Protobuf\FieldMask;
/**
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function update_snapshot_sample(): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$snapshot = new Snapshot();
$updateMask = new FieldMask();
$request = (new UpdateSnapshotRequest())
->setSnapshot($snapshot)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Snapshot $response */
$response = $subscriberClient->updateSnapshot($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateSubscription
Updates an existing subscription by updating the fields specified in the update mask. Note that certain properties of a subscription, such as its topic, are not modifiable.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::updateSubscriptionAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\UpdateSubscriptionRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\V1\Subscription |
use Google\ApiCore\ApiException;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
use Google\Cloud\PubSub\V1\Subscription;
use Google\Cloud\PubSub\V1\UpdateSubscriptionRequest;
use Google\Protobuf\FieldMask;
/**
* @param string $subscriptionName The name of the subscription. It must have the format
* `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
* start with a letter, and contain only letters (`[A-Za-z]`), numbers
* (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
* plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
* in length, and it must not start with `"goog"`.
* @param string $formattedSubscriptionTopic The name of the topic from which this subscription is receiving
* messages. Format is `projects/{project}/topics/{topic}`. The value of this
* field will be `_deleted-topic_` if the topic has been deleted. Please see
* {@see SubscriberClient::topicName()} for help formatting this field.
*/
function update_subscription_sample(
string $subscriptionName,
string $formattedSubscriptionTopic
): void {
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$subscription = (new Subscription())
->setName($subscriptionName)
->setTopic($formattedSubscriptionTopic);
$updateMask = new FieldMask();
$request = (new UpdateSubscriptionRequest())
->setSubscription($subscription)
->setUpdateMask($updateMask);
// Call the API and handle any network failures.
try {
/** @var Subscription $response */
$response = $subscriberClient->updateSubscription($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$subscriptionName = '[NAME]';
$formattedSubscriptionTopic = SubscriberClient::topicName('[PROJECT]', '[TOPIC]');
update_subscription_sample($subscriptionName, $formattedSubscriptionTopic);
}
getIamPolicy
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::getIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
/**
* @param string $resource REQUIRED: The resource for which the policy is being requested.
* See the operation documentation for the appropriate value for this field.
*/
function get_iam_policy_sample(string $resource): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$request = (new GetIamPolicyRequest())
->setResource($resource);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $subscriberClient->getIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
get_iam_policy_sample($resource);
}
setIamPolicy
Sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND
, INVALID_ARGUMENT
, and PERMISSION_DENIED
errors.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::setIamPolicyAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\Policy |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
/**
* @param string $resource REQUIRED: The resource for which the policy is being specified.
* See the operation documentation for the appropriate value for this field.
*/
function set_iam_policy_sample(string $resource): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$policy = new Policy();
$request = (new SetIamPolicyRequest())
->setResource($resource)
->setPolicy($policy);
// Call the API and handle any network failures.
try {
/** @var Policy $response */
$response = $subscriberClient->setIamPolicy($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
set_iam_policy_sample($resource);
}
testIamPermissions
Returns permissions that a caller has on the specified resource. If the
resource does not exist, this will return an empty set of
permissions, not a NOT_FOUND
error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
The async variant is Google\Cloud\PubSub\V1\Client\SubscriberClient::testIamPermissionsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
A request to house fields associated with the call. |
callOptions |
array
Optional. |
↳ retrySettings |
RetrySettings|array
Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage. |
Returns | |
---|---|
Type | Description |
Google\Cloud\Iam\V1\TestIamPermissionsResponse |
use Google\ApiCore\ApiException;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;
use Google\Cloud\PubSub\V1\Client\SubscriberClient;
/**
* @param string $resource REQUIRED: The resource for which the policy detail is being requested.
* See the operation documentation for the appropriate value for this field.
* @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
* wildcards (such as '*' or 'storage.*') are not allowed. For more
* information see
* [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
*/
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
// Create a client.
$subscriberClient = new SubscriberClient();
// Prepare the request message.
$permissions = [$permissionsElement,];
$request = (new TestIamPermissionsRequest())
->setResource($resource)
->setPermissions($permissions);
// Call the API and handle any network failures.
try {
/** @var TestIamPermissionsResponse $response */
$response = $subscriberClient->testIamPermissions($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$resource = '[RESOURCE]';
$permissionsElement = '[PERMISSIONS]';
test_iam_permissions_sample($resource, $permissionsElement);
}
acknowledgeAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\AcknowledgeRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createSnapshotAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\CreateSnapshotRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createSubscriptionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\Subscription
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteSnapshotAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\DeleteSnapshotRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteSubscriptionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\DeleteSubscriptionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getSnapshotAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\GetSnapshotRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getSubscriptionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\GetSubscriptionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listSnapshotsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ListSnapshotsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listSubscriptionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ListSubscriptionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
modifyAckDeadlineAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ModifyAckDeadlineRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
modifyPushConfigAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\ModifyPushConfigRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
pullAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\PullRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
seekAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\SeekRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateSnapshotAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\UpdateSnapshotRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateSubscriptionAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\PubSub\V1\UpdateSubscriptionRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\GetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
setIamPolicyAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\SetIamPolicyRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
testIamPermissionsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Iam\V1\TestIamPermissionsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
static::deletedTopicName
Formats a string containing the fully-qualified path to represent a deleted-topic resource.
Returns | |
---|---|
Type | Description |
string |
The formatted _deleted-topic_ resource. |
static::projectName
Formats a string containing the fully-qualified path to represent a project resource.
Parameter | |
---|---|
Name | Description |
project |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project resource. |
static::projectTopicName
Formats a string containing the fully-qualified path to represent a project_topic resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
topic |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted project_topic resource. |
static::snapshotName
Formats a string containing the fully-qualified path to represent a snapshot resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
snapshot |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted snapshot resource. |
static::subscriptionName
Formats a string containing the fully-qualified path to represent a subscription resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
subscription |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted subscription resource. |
static::topicName
Formats a string containing the fully-qualified path to represent a topic resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
topic |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted topic resource. |
static::parseName
Parses a formatted name string and returns an associative array of the components in the name.
The following name formats are supported: Template: Pattern
- deletedTopic: deleted-topic
- project: projects/{project}
- projectTopic: projects/{project}/topics/{topic}
- snapshot: projects/{project}/snapshots/{snapshot}
- subscription: projects/{project}/subscriptions/{subscription}
- topic: projects/{project}/topics/{topic}
The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.
Parameters | |
---|---|
Name | Description |
formattedName |
string
The formatted name string |
template |
string
Optional name of template to match |
Returns | |
---|---|
Type | Description |
array |
An associative array from name component IDs to component values. |