Cloud PubSub Client - Class Snapshot (2.8.0)

Reference documentation and code samples for the Cloud PubSub Client class Snapshot.

Represents a Pub/Sub Snapshot

Example:

use Google\Cloud\PubSub\PubSubClient;

$pubsub = new PubSubClient(['projectId' => 'my-project']);

$snapshot = $pubsub->snapshot($snapshotName);

Namespace

Google \ Cloud \ PubSub

Methods

__construct

Parameters
Name Description
requestHandler Google\Cloud\Core\RequestHandler
serializer Google\ApiCore\Serializer

The serializer instance to encode/decode messages.

projectId string

The current Project ID.

name string

The snapshot name.

encode bool

Whether certain request arguments should be base64-encoded.

info array

[optional] The snapshot data. When creating a Snapshot, this array must contain a $info.subscription argument with a fully-qualified subscription name.

clientConfig array

[optional] Configuration options for the PubSub client used to handle processing of batch items through the daemon. For valid options please see Google\Cloud\PubSub\PubSubClient::__construct(). Defaults to the options provided to the PubSub client associated with this instance.

name

Get the Snapshot name.

Example:

echo $snapshot->name();
Returns
Type Description
string

info

Get the snapshot info.

Example:

$info = $snapshot->info();
Returns
Type Description
array

create

Create a new Snapshot.

When creating a snapshot, a subscription name must be supplied at instantiation.

Please note that this method may not yet be available in your project.

Example:

$info = $snapshot->create();
Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
array

delete

Delete the snapshot.

Please note that this method may not yet be available in your project.

Example:

$snapshot->delete();
Parameter
Name Description
options array

[optional] Configuration options.

Returns
Type Description
void

topic

Get the Topic attached to the snapshot, if one exists.

Example:

$topic = $snapshot->topic();
Returns
Type Description
Google\Cloud\PubSub\Topic|null

subscription

Get the Subscription attached to the snapshot, if one exists.

Example:

$subscription = $snapshot->subscription();
Returns
Type Description
Google\Cloud\PubSub\Subscription|null

__debugInfo