Cloud Pub/Sub v1 API - Class SubscriberServiceApiClient (3.15.0)

public abstract class SubscriberServiceApiClient

Reference documentation and code samples for the Cloud Pub/Sub v1 API class SubscriberServiceApiClient.

SubscriberServiceApi client wrapper, for convenient use.

Inheritance

object > SubscriberServiceApiClient

Namespace

Google.Cloud.PubSub.V1

Assembly

Google.Cloud.PubSub.V1.dll

Remarks

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.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the SubscriberServiceApi service, which is a host of "pubsub.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default SubscriberServiceApi scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual Subscriber.SubscriberClient GrpcClient { get; }

The underlying gRPC SubscriberServiceApi client

Property Value
Type Description
SubscriberSubscriberClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Acknowledge(AcknowledgeRequest, CallSettings)

public virtual void Acknowledge(AcknowledgeRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request AcknowledgeRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
AcknowledgeRequest request = new AcknowledgeRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckIds = { "", },
};
// Make the request
subscriberServiceApiClient.Acknowledge(request);

Acknowledge(SubscriptionName, IEnumerable<string>, CallSettings)

public virtual void Acknowledge(SubscriptionName subscription, IEnumerable<string> ackIds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
subscriberServiceApiClient.Acknowledge(subscription, ackIds);

Acknowledge(string, IEnumerable<string>, CallSettings)

public virtual void Acknowledge(string subscription, IEnumerable<string> ackIds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
subscriberServiceApiClient.Acknowledge(subscription, ackIds);

AcknowledgeAsync(AcknowledgeRequest, CallSettings)

public virtual Task AcknowledgeAsync(AcknowledgeRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request AcknowledgeRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
AcknowledgeRequest request = new AcknowledgeRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckIds = { "", },
};
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(request);

AcknowledgeAsync(AcknowledgeRequest, CancellationToken)

public virtual Task AcknowledgeAsync(AcknowledgeRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request AcknowledgeRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
AcknowledgeRequest request = new AcknowledgeRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckIds = { "", },
};
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(request);

AcknowledgeAsync(SubscriptionName, IEnumerable<string>, CallSettings)

public virtual Task AcknowledgeAsync(SubscriptionName subscription, IEnumerable<string> ackIds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(subscription, ackIds);

AcknowledgeAsync(SubscriptionName, IEnumerable<string>, CancellationToken)

public virtual Task AcknowledgeAsync(SubscriptionName subscription, IEnumerable<string> ackIds, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(subscription, ackIds);

AcknowledgeAsync(string, IEnumerable<string>, CallSettings)

public virtual Task AcknowledgeAsync(string subscription, IEnumerable<string> ackIds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(subscription, ackIds);

AcknowledgeAsync(string, IEnumerable<string>, CancellationToken)

public virtual Task AcknowledgeAsync(string subscription, IEnumerable<string> ackIds, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription string

Required. The subscription whose message is being acknowledged. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. The acknowledgment ID for the messages being acknowledged that was returned by the Pub/Sub system in the Pull response. Must not be empty.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
// Make the request
await subscriberServiceApiClient.AcknowledgeAsync(subscription, ackIds);

Create()

public static SubscriberServiceApiClient Create()

Synchronously creates a SubscriberServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SubscriberServiceApiClientBuilder.

Returns
Type Description
SubscriberServiceApiClient

The created SubscriberServiceApiClient.

CreateAsync(CancellationToken)

public static Task<SubscriberServiceApiClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a SubscriberServiceApiClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use SubscriberServiceApiClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskSubscriberServiceApiClient

The task representing the created SubscriberServiceApiClient.

CreateSnapshot(CreateSnapshotRequest, CallSettings)

public virtual Snapshot CreateSnapshot(CreateSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request CreateSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
CreateSnapshotRequest request = new CreateSnapshotRequest
{
    SnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Labels = { { "", "" }, },
};
// Make the request
Snapshot response = subscriberServiceApiClient.CreateSnapshot(request);

CreateSnapshot(SnapshotName, SubscriptionName, CallSettings)

public virtual Snapshot CreateSnapshot(SnapshotName name, SubscriptionName subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
name SnapshotName

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription SubscriptionName

Required. 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}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SnapshotName name = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Snapshot response = subscriberServiceApiClient.CreateSnapshot(name, subscription);

CreateSnapshot(string, string, CallSettings)

public virtual Snapshot CreateSnapshot(string name, string subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
name string

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription string

Required. 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}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Snapshot response = subscriberServiceApiClient.CreateSnapshot(name, subscription);

CreateSnapshotAsync(CreateSnapshotRequest, CallSettings)

public virtual Task<Snapshot> CreateSnapshotAsync(CreateSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request CreateSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
CreateSnapshotRequest request = new CreateSnapshotRequest
{
    SnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Labels = { { "", "" }, },
};
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(request);

CreateSnapshotAsync(CreateSnapshotRequest, CancellationToken)

public virtual Task<Snapshot> CreateSnapshotAsync(CreateSnapshotRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request CreateSnapshotRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
CreateSnapshotRequest request = new CreateSnapshotRequest
{
    SnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Labels = { { "", "" }, },
};
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(request);

CreateSnapshotAsync(SnapshotName, SubscriptionName, CallSettings)

public virtual Task<Snapshot> CreateSnapshotAsync(SnapshotName name, SubscriptionName subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
name SnapshotName

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription SubscriptionName

Required. 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}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName name = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(name, subscription);

CreateSnapshotAsync(SnapshotName, SubscriptionName, CancellationToken)

public virtual Task<Snapshot> CreateSnapshotAsync(SnapshotName name, SubscriptionName subscription, CancellationToken cancellationToken)

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.

Parameters
Name Description
name SnapshotName

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription SubscriptionName

Required. 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}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName name = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(name, subscription);

CreateSnapshotAsync(string, string, CallSettings)

public virtual Task<Snapshot> CreateSnapshotAsync(string name, string subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
name string

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription string

Required. 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}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(name, subscription);

CreateSnapshotAsync(string, string, CancellationToken)

public virtual Task<Snapshot> CreateSnapshotAsync(string name, string subscription, CancellationToken cancellationToken)

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.

Parameters
Name Description
name string

Required. 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. Format is projects/{project}/snapshots/{snap}.

subscription string

Required. 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}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Snapshot response = await subscriberServiceApiClient.CreateSnapshotAsync(name, subscription);

CreateSubscription(Subscription, CallSettings)

public virtual Subscription CreateSubscription(Subscription request, CallSettings callSettings = null)

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.

Parameters
Name Description
request Subscription

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
Subscription request = new Subscription
{
    SubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    PushConfig = new PushConfig(),
    AckDeadlineSeconds = 0,
    RetainAckedMessages = false,
    MessageRetentionDuration = new Duration(),
    Labels = { { "", "" }, },
    EnableMessageOrdering = false,
    ExpirationPolicy = new ExpirationPolicy(),
    Filter = "",
    DeadLetterPolicy = new DeadLetterPolicy(),
    RetryPolicy = new RetryPolicy(),
    Detached = false,
    EnableExactlyOnceDelivery = false,
    TopicMessageRetentionDuration = new Duration(),
    BigqueryConfig = new BigQueryConfig(),
    State = Subscription.Types.State.Unspecified,
    CloudStorageConfig = new CloudStorageConfig(),
};
// Make the request
Subscription response = subscriberServiceApiClient.CreateSubscription(request);

CreateSubscription(SubscriptionName, TopicName, PushConfig, int, CallSettings)

public virtual Subscription CreateSubscription(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
name SubscriptionName

Required. 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".

topic TopicName

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);
TopicName topicName = new TopicName(projectId, topicId);
Subscription subscription = client.CreateSubscription(
    subscriptionName, topicName, pushConfig: null, ackDeadlineSeconds: 30);
Console.WriteLine($"Created {subscription.Name} subscribed to {subscription.Topic}");

CreateSubscription(string, string, PushConfig, int, CallSettings)

public virtual Subscription CreateSubscription(string name, string topic, PushConfig pushConfig, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
name string

Required. 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".

topic string

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
string topic = "projects/[PROJECT]/topics/[TOPIC]";
PushConfig pushConfig = new PushConfig();
int ackDeadlineSeconds = 0;
// Make the request
Subscription response = subscriberServiceApiClient.CreateSubscription(name, topic, pushConfig, ackDeadlineSeconds);

CreateSubscriptionAsync(Subscription, CallSettings)

public virtual Task<Subscription> CreateSubscriptionAsync(Subscription request, CallSettings callSettings = null)

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.

Parameters
Name Description
request Subscription

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Subscription request = new Subscription
{
    SubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    PushConfig = new PushConfig(),
    AckDeadlineSeconds = 0,
    RetainAckedMessages = false,
    MessageRetentionDuration = new Duration(),
    Labels = { { "", "" }, },
    EnableMessageOrdering = false,
    ExpirationPolicy = new ExpirationPolicy(),
    Filter = "",
    DeadLetterPolicy = new DeadLetterPolicy(),
    RetryPolicy = new RetryPolicy(),
    Detached = false,
    EnableExactlyOnceDelivery = false,
    TopicMessageRetentionDuration = new Duration(),
    BigqueryConfig = new BigQueryConfig(),
    State = Subscription.Types.State.Unspecified,
    CloudStorageConfig = new CloudStorageConfig(),
};
// Make the request
Subscription response = await subscriberServiceApiClient.CreateSubscriptionAsync(request);

CreateSubscriptionAsync(Subscription, CancellationToken)

public virtual Task<Subscription> CreateSubscriptionAsync(Subscription request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request Subscription

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Subscription request = new Subscription
{
    SubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    TopicAsTopicName = TopicName.FromProjectTopic("[PROJECT]", "[TOPIC]"),
    PushConfig = new PushConfig(),
    AckDeadlineSeconds = 0,
    RetainAckedMessages = false,
    MessageRetentionDuration = new Duration(),
    Labels = { { "", "" }, },
    EnableMessageOrdering = false,
    ExpirationPolicy = new ExpirationPolicy(),
    Filter = "",
    DeadLetterPolicy = new DeadLetterPolicy(),
    RetryPolicy = new RetryPolicy(),
    Detached = false,
    EnableExactlyOnceDelivery = false,
    TopicMessageRetentionDuration = new Duration(),
    BigqueryConfig = new BigQueryConfig(),
    State = Subscription.Types.State.Unspecified,
    CloudStorageConfig = new CloudStorageConfig(),
};
// Make the request
Subscription response = await subscriberServiceApiClient.CreateSubscriptionAsync(request);

CreateSubscriptionAsync(SubscriptionName, TopicName, PushConfig, int, CallSettings)

public virtual Task<Subscription> CreateSubscriptionAsync(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
name SubscriptionName

Required. 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".

topic TopicName

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);
TopicName topicName = new TopicName(projectId, topicId);
Subscription subscription = await client.CreateSubscriptionAsync(
    subscriptionName, topicName, pushConfig: null, ackDeadlineSeconds: 30);
Console.WriteLine($"Created {subscription.Name} subscribed to {subscription.Topic}");

CreateSubscriptionAsync(SubscriptionName, TopicName, PushConfig, int, CancellationToken)

public virtual Task<Subscription> CreateSubscriptionAsync(SubscriptionName name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds, CancellationToken cancellationToken)

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.

Parameters
Name Description
name SubscriptionName

Required. 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".

topic TopicName

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);
TopicName topicName = new TopicName(projectId, topicId);
Subscription subscription = await client.CreateSubscriptionAsync(
    subscriptionName, topicName, pushConfig: null, ackDeadlineSeconds: 30);
Console.WriteLine($"Created {subscription.Name} subscribed to {subscription.Topic}");

CreateSubscriptionAsync(string, string, PushConfig, int, CallSettings)

public virtual Task<Subscription> CreateSubscriptionAsync(string name, string topic, PushConfig pushConfig, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
name string

Required. 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".

topic string

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
string topic = "projects/[PROJECT]/topics/[TOPIC]";
PushConfig pushConfig = new PushConfig();
int ackDeadlineSeconds = 0;
// Make the request
Subscription response = await subscriberServiceApiClient.CreateSubscriptionAsync(name, topic, pushConfig, ackDeadlineSeconds);

CreateSubscriptionAsync(string, string, PushConfig, int, CancellationToken)

public virtual Task<Subscription> CreateSubscriptionAsync(string name, string topic, PushConfig pushConfig, int ackDeadlineSeconds, CancellationToken cancellationToken)

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.

Parameters
Name Description
name string

Required. 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".

topic string

Required. 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.

pushConfig PushConfig

Optional. If push delivery is used with this subscription, this field is used to configure it.

ackDeadlineSeconds int

Optional. The approximate amount of time (on a best-effort basis) Pub/Sub waits for the subscriber to acknowledge receipt before resending the message. In the interval after the message is delivered and before it is acknowledged, it is considered to be outstanding. During that time period, the message will not be redelivered (on a best-effort basis).

For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call ModifyAckDeadline with the corresponding ack_id if using non-streaming pull or send the ack_id in a StreamingModifyAckDeadlineRequest if using streaming pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used.

For push delivery, this value is also used to set the request timeout for the call to the push endpoint.

If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
string topic = "projects/[PROJECT]/topics/[TOPIC]";
PushConfig pushConfig = new PushConfig();
int ackDeadlineSeconds = 0;
// Make the request
Subscription response = await subscriberServiceApiClient.CreateSubscriptionAsync(name, topic, pushConfig, ackDeadlineSeconds);

DeleteSnapshot(DeleteSnapshotRequest, CallSettings)

public virtual void DeleteSnapshot(DeleteSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
DeleteSnapshotRequest request = new DeleteSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
subscriberServiceApiClient.DeleteSnapshot(request);

DeleteSnapshot(SnapshotName, CallSettings)

public virtual void DeleteSnapshot(SnapshotName snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
subscriberServiceApiClient.DeleteSnapshot(snapshot);

DeleteSnapshot(string, CallSettings)

public virtual void DeleteSnapshot(string snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
subscriberServiceApiClient.DeleteSnapshot(snapshot);

DeleteSnapshotAsync(DeleteSnapshotRequest, CallSettings)

public virtual Task DeleteSnapshotAsync(DeleteSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteSnapshotRequest request = new DeleteSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(request);

DeleteSnapshotAsync(DeleteSnapshotRequest, CancellationToken)

public virtual Task DeleteSnapshotAsync(DeleteSnapshotRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request DeleteSnapshotRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteSnapshotRequest request = new DeleteSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(request);

DeleteSnapshotAsync(SnapshotName, CallSettings)

public virtual Task DeleteSnapshotAsync(SnapshotName snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(snapshot);

DeleteSnapshotAsync(SnapshotName, CancellationToken)

public virtual Task DeleteSnapshotAsync(SnapshotName snapshot, CancellationToken cancellationToken)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(snapshot);

DeleteSnapshotAsync(string, CallSettings)

public virtual Task DeleteSnapshotAsync(string snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(snapshot);

DeleteSnapshotAsync(string, CancellationToken)

public virtual Task DeleteSnapshotAsync(string snapshot, CancellationToken cancellationToken)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to delete. Format is projects/{project}/snapshots/{snap}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
await subscriberServiceApiClient.DeleteSnapshotAsync(snapshot);

DeleteSubscription(DeleteSubscriptionRequest, CallSettings)

public virtual void DeleteSubscription(DeleteSubscriptionRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
DeleteSubscriptionRequest request = new DeleteSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
subscriberServiceApiClient.DeleteSubscription(request);

DeleteSubscription(SubscriptionName, CallSettings)

public virtual void DeleteSubscription(SubscriptionName subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
subscriberServiceApiClient.DeleteSubscription(subscription);

DeleteSubscription(string, CallSettings)

public virtual void DeleteSubscription(string subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
subscriberServiceApiClient.DeleteSubscription(subscription);

DeleteSubscriptionAsync(DeleteSubscriptionRequest, CallSettings)

public virtual Task DeleteSubscriptionAsync(DeleteSubscriptionRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request DeleteSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteSubscriptionRequest request = new DeleteSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(request);

DeleteSubscriptionAsync(DeleteSubscriptionRequest, CancellationToken)

public virtual Task DeleteSubscriptionAsync(DeleteSubscriptionRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request DeleteSubscriptionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
DeleteSubscriptionRequest request = new DeleteSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(request);

DeleteSubscriptionAsync(SubscriptionName, CallSettings)

public virtual Task DeleteSubscriptionAsync(SubscriptionName subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(subscription);

DeleteSubscriptionAsync(SubscriptionName, CancellationToken)

public virtual Task DeleteSubscriptionAsync(SubscriptionName subscription, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(subscription);

DeleteSubscriptionAsync(string, CallSettings)

public virtual Task DeleteSubscriptionAsync(string subscription, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(subscription);

DeleteSubscriptionAsync(string, CancellationToken)

public virtual Task DeleteSubscriptionAsync(string subscription, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription string

Required. The subscription to delete. Format is projects/{project}/subscriptions/{sub}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
await subscriberServiceApiClient.DeleteSubscriptionAsync(subscription);

GetSnapshot(GetSnapshotRequest, CallSettings)

public virtual Snapshot GetSnapshot(GetSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request GetSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
GetSnapshotRequest request = new GetSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
Snapshot response = subscriberServiceApiClient.GetSnapshot(request);

GetSnapshot(SnapshotName, CallSettings)

public virtual Snapshot GetSnapshot(SnapshotName snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
Snapshot response = subscriberServiceApiClient.GetSnapshot(snapshot);

GetSnapshot(string, CallSettings)

public virtual Snapshot GetSnapshot(string snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
Snapshot response = subscriberServiceApiClient.GetSnapshot(snapshot);

GetSnapshotAsync(GetSnapshotRequest, CallSettings)

public virtual Task<Snapshot> GetSnapshotAsync(GetSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request GetSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetSnapshotRequest request = new GetSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(request);

GetSnapshotAsync(GetSnapshotRequest, CancellationToken)

public virtual Task<Snapshot> GetSnapshotAsync(GetSnapshotRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request GetSnapshotRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetSnapshotRequest request = new GetSnapshotRequest
{
    SnapshotAsSnapshotName = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]"),
};
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(request);

GetSnapshotAsync(SnapshotName, CallSettings)

public virtual Task<Snapshot> GetSnapshotAsync(SnapshotName snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);

GetSnapshotAsync(SnapshotName, CancellationToken)

public virtual Task<Snapshot> GetSnapshotAsync(SnapshotName snapshot, CancellationToken cancellationToken)

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.

Parameters
Name Description
snapshot SnapshotName

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SnapshotName snapshot = SnapshotName.FromProjectSnapshot("[PROJECT]", "[SNAPSHOT]");
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);

GetSnapshotAsync(string, CallSettings)

public virtual Task<Snapshot> GetSnapshotAsync(string snapshot, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);

GetSnapshotAsync(string, CancellationToken)

public virtual Task<Snapshot> GetSnapshotAsync(string snapshot, CancellationToken cancellationToken)

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.

Parameters
Name Description
snapshot string

Required. The name of the snapshot to get. Format is projects/{project}/snapshots/{snap}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string snapshot = "projects/[PROJECT]/snapshots/[SNAPSHOT]";
// Make the request
Snapshot response = await subscriberServiceApiClient.GetSnapshotAsync(snapshot);

GetSubscription(GetSubscriptionRequest, CallSettings)

public virtual Subscription GetSubscription(GetSubscriptionRequest request, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
request GetSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
GetSubscriptionRequest request = new GetSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
Subscription response = subscriberServiceApiClient.GetSubscription(request);

GetSubscription(SubscriptionName, CallSettings)

public virtual Subscription GetSubscription(SubscriptionName subscription, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Subscription response = subscriberServiceApiClient.GetSubscription(subscription);

GetSubscription(string, CallSettings)

public virtual Subscription GetSubscription(string subscription, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription string

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Subscription response = subscriberServiceApiClient.GetSubscription(subscription);

GetSubscriptionAsync(GetSubscriptionRequest, CallSettings)

public virtual Task<Subscription> GetSubscriptionAsync(GetSubscriptionRequest request, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
request GetSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetSubscriptionRequest request = new GetSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(request);

GetSubscriptionAsync(GetSubscriptionRequest, CancellationToken)

public virtual Task<Subscription> GetSubscriptionAsync(GetSubscriptionRequest request, CancellationToken cancellationToken)

Gets the configuration details of a subscription.

Parameters
Name Description
request GetSubscriptionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
GetSubscriptionRequest request = new GetSubscriptionRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
};
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(request);

GetSubscriptionAsync(SubscriptionName, CallSettings)

public virtual Task<Subscription> GetSubscriptionAsync(SubscriptionName subscription, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(subscription);

GetSubscriptionAsync(SubscriptionName, CancellationToken)

public virtual Task<Subscription> GetSubscriptionAsync(SubscriptionName subscription, CancellationToken cancellationToken)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(subscription);

GetSubscriptionAsync(string, CallSettings)

public virtual Task<Subscription> GetSubscriptionAsync(string subscription, CallSettings callSettings = null)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription string

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(subscription);

GetSubscriptionAsync(string, CancellationToken)

public virtual Task<Subscription> GetSubscriptionAsync(string subscription, CancellationToken cancellationToken)

Gets the configuration details of a subscription.

Parameters
Name Description
subscription string

Required. The name of the subscription to get. Format is projects/{project}/subscriptions/{sub}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
// Make the request
Subscription response = await subscriberServiceApiClient.GetSubscriptionAsync(subscription);

ListSnapshots(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshots(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
Name Description
project ProjectName

Required. The name of the project in which to list snapshots. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSnapshotsResponseSnapshot

A pageable sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
ProjectName project = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshots(project);

// Iterate over all response items, lazily performing RPCs as required
foreach (Snapshot item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSnapshotsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSnapshots(ListSnapshotsRequest, CallSettings)

public virtual PagedEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshots(ListSnapshotsRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ListSnapshotsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSnapshotsResponseSnapshot

A pageable sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
ListSnapshotsRequest request = new ListSnapshotsRequest
{
    ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshots(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Snapshot item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSnapshotsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSnapshots(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshots(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
Name Description
project string

Required. The name of the project in which to list snapshots. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSnapshotsResponseSnapshot

A pageable sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshots(project);

// Iterate over all response items, lazily performing RPCs as required
foreach (Snapshot item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSnapshotsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSnapshotsAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshotsAsync(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
Name Description
project ProjectName

Required. The name of the project in which to list snapshots. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSnapshotsResponseSnapshot

A pageable asynchronous sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ProjectName project = ProjectName.FromProject("[PROJECT]");
// Make the request
PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshotsAsync(project);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Snapshot item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSnapshotsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSnapshotsAsync(ListSnapshotsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshotsAsync(ListSnapshotsRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ListSnapshotsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSnapshotsResponseSnapshot

A pageable asynchronous sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ListSnapshotsRequest request = new ListSnapshotsRequest
{
    ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshotsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Snapshot item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSnapshotsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSnapshotsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> ListSnapshotsAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
Name Description
project string

Required. The name of the project in which to list snapshots. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSnapshotsResponseSnapshot

A pageable asynchronous sequence of Snapshot resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListSnapshotsResponse, Snapshot> response = subscriberServiceApiClient.ListSnapshotsAsync(project);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Snapshot item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSnapshotsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Snapshot item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Snapshot> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Snapshot item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSubscriptions(ProjectName, string, int?, CallSettings)

public virtual PagedEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptions(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
project ProjectName

Required. The name of the project in which to list subscriptions. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSubscriptionsResponseSubscription

A pageable sequence of Subscription resources.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

ProjectName projectName = new ProjectName(projectId);
foreach (Subscription subscription in client.ListSubscriptions(projectName))
{
    Console.WriteLine($"{subscription.Name} subscribed to {subscription.Topic}");
}

ListSubscriptions(ListSubscriptionsRequest, CallSettings)

public virtual PagedEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptions(ListSubscriptionsRequest request, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
request ListSubscriptionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSubscriptionsResponseSubscription

A pageable sequence of Subscription resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
ListSubscriptionsRequest request = new ListSubscriptionsRequest
{
    ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedEnumerable<ListSubscriptionsResponse, Subscription> response = subscriberServiceApiClient.ListSubscriptions(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Subscription item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSubscriptionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Subscription item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Subscription> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Subscription item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSubscriptions(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptions(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
project string

Required. The name of the project in which to list subscriptions. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListSubscriptionsResponseSubscription

A pageable sequence of Subscription resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedEnumerable<ListSubscriptionsResponse, Subscription> response = subscriberServiceApiClient.ListSubscriptions(project);

// Iterate over all response items, lazily performing RPCs as required
foreach (Subscription item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListSubscriptionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Subscription item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Subscription> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Subscription item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSubscriptionsAsync(ProjectName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptionsAsync(ProjectName project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
project ProjectName

Required. The name of the project in which to list subscriptions. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSubscriptionsResponseSubscription

A pageable asynchronous sequence of Subscription resources.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

ProjectName projectName = new ProjectName(projectId);
IAsyncEnumerable<Subscription> subscriptions = client.ListSubscriptionsAsync(projectName);
await subscriptions.ForEachAsync(subscription =>
{
    Console.WriteLine($"{subscription.Name} subscribed to {subscription.Topic}");
});

ListSubscriptionsAsync(ListSubscriptionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptionsAsync(ListSubscriptionsRequest request, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
request ListSubscriptionsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSubscriptionsResponseSubscription

A pageable asynchronous sequence of Subscription resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ListSubscriptionsRequest request = new ListSubscriptionsRequest
{
    ProjectAsProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
PagedAsyncEnumerable<ListSubscriptionsResponse, Subscription> response = subscriberServiceApiClient.ListSubscriptionsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Subscription item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSubscriptionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Subscription item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Subscription> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Subscription item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListSubscriptionsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListSubscriptionsResponse, Subscription> ListSubscriptionsAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists matching subscriptions.

Parameters
Name Description
project string

Required. The name of the project in which to list subscriptions. Format is projects/{project-id}.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListSubscriptionsResponseSubscription

A pageable asynchronous sequence of Subscription resources.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string project = "projects/[PROJECT]";
// Make the request
PagedAsyncEnumerable<ListSubscriptionsResponse, Subscription> response = subscriberServiceApiClient.ListSubscriptionsAsync(project);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Subscription item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListSubscriptionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Subscription item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Subscription> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Subscription item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ModifyAckDeadline(ModifyAckDeadlineRequest, CallSettings)

public virtual void ModifyAckDeadline(ModifyAckDeadlineRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ModifyAckDeadlineRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
ModifyAckDeadlineRequest request = new ModifyAckDeadlineRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckDeadlineSeconds = 0,
    AckIds = { "", },
};
// Make the request
subscriberServiceApiClient.ModifyAckDeadline(request);

ModifyAckDeadline(SubscriptionName, IEnumerable<string>, int, CallSettings)

public virtual void ModifyAckDeadline(SubscriptionName subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
subscriberServiceApiClient.ModifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);

ModifyAckDeadline(string, IEnumerable<string>, int, CallSettings)

public virtual void ModifyAckDeadline(string subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
subscriberServiceApiClient.ModifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);

ModifyAckDeadlineAsync(ModifyAckDeadlineRequest, CallSettings)

public virtual Task ModifyAckDeadlineAsync(ModifyAckDeadlineRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ModifyAckDeadlineRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ModifyAckDeadlineRequest request = new ModifyAckDeadlineRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckDeadlineSeconds = 0,
    AckIds = { "", },
};
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(request);

ModifyAckDeadlineAsync(ModifyAckDeadlineRequest, CancellationToken)

public virtual Task ModifyAckDeadlineAsync(ModifyAckDeadlineRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request ModifyAckDeadlineRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ModifyAckDeadlineRequest request = new ModifyAckDeadlineRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    AckDeadlineSeconds = 0,
    AckIds = { "", },
};
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(request);

ModifyAckDeadlineAsync(SubscriptionName, IEnumerable<string>, int, CallSettings)

public virtual Task ModifyAckDeadlineAsync(SubscriptionName subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(subscription, ackIds, ackDeadlineSeconds);

ModifyAckDeadlineAsync(SubscriptionName, IEnumerable<string>, int, CancellationToken)

public virtual Task ModifyAckDeadlineAsync(SubscriptionName subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(subscription, ackIds, ackDeadlineSeconds);

ModifyAckDeadlineAsync(string, IEnumerable<string>, int, CallSettings)

public virtual Task ModifyAckDeadlineAsync(string subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(subscription, ackIds, ackDeadlineSeconds);

ModifyAckDeadlineAsync(string, IEnumerable<string>, int, CancellationToken)

public virtual Task ModifyAckDeadlineAsync(string subscription, IEnumerable<string> ackIds, int ackDeadlineSeconds, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

ackIds IEnumerablestring

Required. List of acknowledgment IDs.

ackDeadlineSeconds int

Required. 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).

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
IEnumerable<string> ackIds = new string[] { "", };
int ackDeadlineSeconds = 0;
// Make the request
await subscriberServiceApiClient.ModifyAckDeadlineAsync(subscription, ackIds, ackDeadlineSeconds);

ModifyPushConfig(ModifyPushConfigRequest, CallSettings)

public virtual void ModifyPushConfig(ModifyPushConfigRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ModifyPushConfigRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
ModifyPushConfigRequest request = new ModifyPushConfigRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    PushConfig = new PushConfig(),
};
// Make the request
subscriberServiceApiClient.ModifyPushConfig(request);

ModifyPushConfig(SubscriptionName, PushConfig, CallSettings)

public virtual void ModifyPushConfig(SubscriptionName subscription, PushConfig pushConfig, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = new PushConfig();
// Make the request
subscriberServiceApiClient.ModifyPushConfig(subscription, pushConfig);

ModifyPushConfig(string, PushConfig, CallSettings)

public virtual void ModifyPushConfig(string subscription, PushConfig pushConfig, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
PushConfig pushConfig = new PushConfig();
// Make the request
subscriberServiceApiClient.ModifyPushConfig(subscription, pushConfig);

ModifyPushConfigAsync(ModifyPushConfigRequest, CallSettings)

public virtual Task ModifyPushConfigAsync(ModifyPushConfigRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request ModifyPushConfigRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ModifyPushConfigRequest request = new ModifyPushConfigRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    PushConfig = new PushConfig(),
};
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(request);

ModifyPushConfigAsync(ModifyPushConfigRequest, CancellationToken)

public virtual Task ModifyPushConfigAsync(ModifyPushConfigRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request ModifyPushConfigRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
ModifyPushConfigRequest request = new ModifyPushConfigRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    PushConfig = new PushConfig(),
};
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(request);

ModifyPushConfigAsync(SubscriptionName, PushConfig, CallSettings)

public virtual Task ModifyPushConfigAsync(SubscriptionName subscription, PushConfig pushConfig, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = new PushConfig();
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(subscription, pushConfig);

ModifyPushConfigAsync(SubscriptionName, PushConfig, CancellationToken)

public virtual Task ModifyPushConfigAsync(SubscriptionName subscription, PushConfig pushConfig, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription SubscriptionName

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = new PushConfig();
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(subscription, pushConfig);

ModifyPushConfigAsync(string, PushConfig, CallSettings)

public virtual Task ModifyPushConfigAsync(string subscription, PushConfig pushConfig, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
PushConfig pushConfig = new PushConfig();
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(subscription, pushConfig);

ModifyPushConfigAsync(string, PushConfig, CancellationToken)

public virtual Task ModifyPushConfigAsync(string subscription, PushConfig pushConfig, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription string

Required. The name of the subscription. Format is projects/{project}/subscriptions/{sub}.

pushConfig PushConfig

Required. The push configuration for future deliveries.

An empty pushConfig indicates that the Pub/Sub system should stop pushing messages from the given subscription and allow messages to be pulled and acknowledged - effectively pausing the subscription if Pull or StreamingPull is not called.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
PushConfig pushConfig = new PushConfig();
// Make the request
await subscriberServiceApiClient.ModifyPushConfigAsync(subscription, pushConfig);

Pull(PullRequest, CallSettings)

public virtual PullResponse Pull(PullRequest request, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
request PullRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PullResponse

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
PullRequest request = new PullRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    MaxMessages = 0,
};
// Make the request
PullResponse response = subscriberServiceApiClient.Pull(request);

Pull(SubscriptionName, bool, int, CallSettings)

[Obsolete]
public virtual PullResponse Pull(SubscriptionName subscription, bool returnImmediately, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PullResponse

The RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);

PullResponse pullResponse = client.Pull(subscriptionName, maxMessages: 100);
foreach (ReceivedMessage message in pullResponse.ReceivedMessages)
{
    // Messages can contain any data. We'll assume that we know this
    // topic publishes UTF-8-encoded text.
    Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
}

// Acknowledge the messages after pulling them, so we don't pull them
// a second time later. The ackDeadlineSeconds parameter specified when
// the subscription is created determines how quickly you need to acknowledge
// successfully-pulled messages before they will be redelivered.
var ackIds = pullResponse.ReceivedMessages.Select(rm => rm.AckId);
client.Acknowledge(subscriptionName, ackIds);

Pull(SubscriptionName, int, CallSettings)

public virtual PullResponse Pull(SubscriptionName subscription, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PullResponse

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 0;
// Make the request
PullResponse response = subscriberServiceApiClient.Pull(subscription, maxMessages);

Pull(string, bool, int, CallSettings)

[Obsolete]
public virtual PullResponse Pull(string subscription, bool returnImmediately, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PullResponse

The RPC response.

Example
            // Create client
            SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
            // Initialize request argument(s)
            string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
            bool returnImmediately = false;
            int maxMessages = 0;
            // Make the request
#pragma warning disable CS0612
            PullResponse response = subscriberServiceApiClient.Pull(subscription, returnImmediately, maxMessages);
#pragma warning restore CS0612

Pull(string, int, CallSettings)

public virtual PullResponse Pull(string subscription, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PullResponse

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
int maxMessages = 0;
// Make the request
PullResponse response = subscriberServiceApiClient.Pull(subscription, maxMessages);

PullAsync(PullRequest, CallSettings)

public virtual Task<PullResponse> PullAsync(PullRequest request, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
request PullRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
PullRequest request = new PullRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    MaxMessages = 0,
};
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(request);

PullAsync(PullRequest, CancellationToken)

public virtual Task<PullResponse> PullAsync(PullRequest request, CancellationToken cancellationToken)

Pulls messages from the server.

Parameters
Name Description
request PullRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
PullRequest request = new PullRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    MaxMessages = 0,
};
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(request);

PullAsync(SubscriptionName, bool, int, CallSettings)

[Obsolete]
public virtual Task<PullResponse> PullAsync(SubscriptionName subscription, bool returnImmediately, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);

PullResponse pullResponse = await client.PullAsync(subscriptionName, maxMessages: 100);
foreach (ReceivedMessage message in pullResponse.ReceivedMessages)
{
    // Messages can contain any data. We'll assume that we know this
    // topic publishes UTF-8-encoded text.
    Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
}

// Acknowledge the messages after pulling them, so we don't pull them
// a second time later. The ackDeadlineSeconds parameter specified when
// the subscription is created determines how quickly you need to acknowledge
// successfully-pulled messages before they will be redelivered.
var ackIds = pullResponse.ReceivedMessages.Select(rm => rm.AckId);
await client.AcknowledgeAsync(subscriptionName, ackIds);

PullAsync(SubscriptionName, bool, int, CancellationToken)

[Obsolete]
public virtual Task<PullResponse> PullAsync(SubscriptionName subscription, bool returnImmediately, int maxMessages, CancellationToken cancellationToken)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
SubscriberServiceApiClient client = SubscriberServiceApiClient.Create();

SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);

PullResponse pullResponse = await client.PullAsync(subscriptionName, maxMessages: 100);
foreach (ReceivedMessage message in pullResponse.ReceivedMessages)
{
    // Messages can contain any data. We'll assume that we know this
    // topic publishes UTF-8-encoded text.
    Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
}

// Acknowledge the messages after pulling them, so we don't pull them
// a second time later. The ackDeadlineSeconds parameter specified when
// the subscription is created determines how quickly you need to acknowledge
// successfully-pulled messages before they will be redelivered.
var ackIds = pullResponse.ReceivedMessages.Select(rm => rm.AckId);
await client.AcknowledgeAsync(subscriptionName, ackIds);

PullAsync(SubscriptionName, int, CallSettings)

public virtual Task<PullResponse> PullAsync(SubscriptionName subscription, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 0;
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, maxMessages);

PullAsync(SubscriptionName, int, CancellationToken)

public virtual Task<PullResponse> PullAsync(SubscriptionName subscription, int maxMessages, CancellationToken cancellationToken)

Pulls messages from the server.

Parameters
Name Description
subscription SubscriptionName

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SubscriptionName subscription = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]");
int maxMessages = 0;
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, maxMessages);

PullAsync(string, bool, int, CallSettings)

[Obsolete]
public virtual Task<PullResponse> PullAsync(string subscription, bool returnImmediately, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
            // Create client
            SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
            // Initialize request argument(s)
            string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
            bool returnImmediately = false;
            int maxMessages = 0;
            // Make the request
#pragma warning disable CS0612
            PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, returnImmediately, maxMessages);
#pragma warning restore CS0612

PullAsync(string, bool, int, CancellationToken)

[Obsolete]
public virtual Task<PullResponse> PullAsync(string subscription, bool returnImmediately, int maxMessages, CancellationToken cancellationToken)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

returnImmediately bool

Optional. If this field set to true, the system will respond immediately even if it there are no messages available to return in the Pull response. Otherwise, the system may wait (for a bounded amount of time) until at least one message is available, rather than returning no messages. Warning: setting this field to true is discouraged because it adversely impacts the performance of Pull operations. We recommend that users do not set this field.

maxMessages int

Required. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
            // Create client
            SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
            // Initialize request argument(s)
            string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
            bool returnImmediately = false;
            int maxMessages = 0;
            // Make the request
#pragma warning disable CS0612
            PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, returnImmediately, maxMessages);
#pragma warning restore CS0612

PullAsync(string, int, CallSettings)

public virtual Task<PullResponse> PullAsync(string subscription, int maxMessages, CallSettings callSettings = null)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
int maxMessages = 0;
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, maxMessages);

PullAsync(string, int, CancellationToken)

public virtual Task<PullResponse> PullAsync(string subscription, int maxMessages, CancellationToken cancellationToken)

Pulls messages from the server.

Parameters
Name Description
subscription string

Required. The subscription from which messages should be pulled. Format is projects/{project}/subscriptions/{sub}.

maxMessages int

Required. 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.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPullResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
string subscription = "projects/[PROJECT]/subscriptions/[SUBSCRIPTION]";
int maxMessages = 0;
// Make the request
PullResponse response = await subscriberServiceApiClient.PullAsync(subscription, maxMessages);

Seek(SeekRequest, CallSettings)

public virtual SeekResponse Seek(SeekRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request SeekRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
SeekResponse

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
SeekRequest request = new SeekRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Time = new Timestamp(),
};
// Make the request
SeekResponse response = subscriberServiceApiClient.Seek(request);

SeekAsync(SeekRequest, CallSettings)

public virtual Task<SeekResponse> SeekAsync(SeekRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request SeekRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSeekResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SeekRequest request = new SeekRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Time = new Timestamp(),
};
// Make the request
SeekResponse response = await subscriberServiceApiClient.SeekAsync(request);

SeekAsync(SeekRequest, CancellationToken)

public virtual Task<SeekResponse> SeekAsync(SeekRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request SeekRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSeekResponse

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
SeekRequest request = new SeekRequest
{
    SubscriptionAsSubscriptionName = SubscriptionName.FromProjectSubscription("[PROJECT]", "[SUBSCRIPTION]"),
    Time = new Timestamp(),
};
// Make the request
SeekResponse response = await subscriberServiceApiClient.SeekAsync(request);

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

StreamingPull(CallSettings, BidirectionalStreamingSettings)

public virtual SubscriberServiceApiClient.StreamingPullStream StreamingPull(CallSettings callSettings = null, BidirectionalStreamingSettings streamingSettings = null)

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
callSettings CallSettings

If not null, applies overrides to this RPC call.

streamingSettings BidirectionalStreamingSettings

If not null, applies streaming overrides to this RPC call.

Returns
Type Description
SubscriberServiceApiClientStreamingPullStream

The client-server stream.

Example
PublisherServiceApiClient publisher = PublisherServiceApiClient.Create();
TopicName topicName = new TopicName(projectId, topicId);
publisher.CreateTopic(topicName);
SubscriberServiceApiClient subscriber = SubscriberServiceApiClient.Create();
SubscriptionName subscriptionName = new SubscriptionName(projectId, subscriptionId);
subscriber.CreateSubscription(subscriptionName, topicName, null, 60);

// If we don't see all the messages we expect in 10 seconds, we'll cancel the call.
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(10));
CallSettings callSettings = CallSettings.FromCancellationToken(cancellationTokenSource.Token);
SubscriberServiceApiClient.StreamingPullStream stream = subscriber.StreamingPull(callSettings);

// The first request must include the subscription name and the stream ack deadline
await stream.WriteAsync(new StreamingPullRequest { SubscriptionAsSubscriptionName = subscriptionName, StreamAckDeadlineSeconds = 20 });

Task pullingTask = Task.Run(async () =>
{
    int messagesSeen = 0;
    AsyncResponseStream<StreamingPullResponse> responseStream = stream.GetResponseStream();

    // Handle responses as we see them.
    while (await responseStream.MoveNextAsync())
    {
        StreamingPullResponse response = responseStream.Current;
        Console.WriteLine("Received streaming response");
        foreach (ReceivedMessage message in response.ReceivedMessages)
        {
            // Messages can contain any data. We'll assume that we know this
            // topic publishes UTF-8-encoded text.
            Console.WriteLine($"Message text: {message.Message.Data.ToStringUtf8()}");
        }
        // Acknowledge the messages we've just seen
        await stream.WriteAsync(new StreamingPullRequest { AckIds = { response.ReceivedMessages.Select(rm => rm.AckId) } });

        // If we've seen all the messages we expect, we can complete the streaming call,
        // and our next MoveNext call will return false.
        messagesSeen += response.ReceivedMessages.Count;
        if (messagesSeen == 3)
        {
            await stream.WriteCompleteAsync();
        }
    }
});

publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 1") } });
publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 2") } });
publisher.Publish(topicName, new[] { new PubsubMessage { Data = ByteString.CopyFromUtf8("Message 3") } });

await pullingTask;

UpdateSnapshot(Snapshot, FieldMask, CallSettings)

public virtual Snapshot UpdateSnapshot(Snapshot snapshot, FieldMask updateMask, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot Snapshot

Required. The updated snapshot object.

updateMask FieldMask

Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
Snapshot snapshot = new Snapshot();
FieldMask updateMask = new FieldMask();
// Make the request
Snapshot response = subscriberServiceApiClient.UpdateSnapshot(snapshot, updateMask);

UpdateSnapshot(UpdateSnapshotRequest, CallSettings)

public virtual Snapshot UpdateSnapshot(UpdateSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request UpdateSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Snapshot

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
UpdateSnapshotRequest request = new UpdateSnapshotRequest
{
    Snapshot = new Snapshot(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snapshot response = subscriberServiceApiClient.UpdateSnapshot(request);

UpdateSnapshotAsync(Snapshot, FieldMask, CallSettings)

public virtual Task<Snapshot> UpdateSnapshotAsync(Snapshot snapshot, FieldMask updateMask, CallSettings callSettings = null)

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.

Parameters
Name Description
snapshot Snapshot

Required. The updated snapshot object.

updateMask FieldMask

Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Snapshot snapshot = new Snapshot();
FieldMask updateMask = new FieldMask();
// Make the request
Snapshot response = await subscriberServiceApiClient.UpdateSnapshotAsync(snapshot, updateMask);

UpdateSnapshotAsync(Snapshot, FieldMask, CancellationToken)

public virtual Task<Snapshot> UpdateSnapshotAsync(Snapshot snapshot, FieldMask updateMask, CancellationToken cancellationToken)

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.

Parameters
Name Description
snapshot Snapshot

Required. The updated snapshot object.

updateMask FieldMask

Required. Indicates which fields in the provided snapshot to update. Must be specified and non-empty.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Snapshot snapshot = new Snapshot();
FieldMask updateMask = new FieldMask();
// Make the request
Snapshot response = await subscriberServiceApiClient.UpdateSnapshotAsync(snapshot, updateMask);

UpdateSnapshotAsync(UpdateSnapshotRequest, CallSettings)

public virtual Task<Snapshot> UpdateSnapshotAsync(UpdateSnapshotRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request UpdateSnapshotRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateSnapshotRequest request = new UpdateSnapshotRequest
{
    Snapshot = new Snapshot(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snapshot response = await subscriberServiceApiClient.UpdateSnapshotAsync(request);

UpdateSnapshotAsync(UpdateSnapshotRequest, CancellationToken)

public virtual Task<Snapshot> UpdateSnapshotAsync(UpdateSnapshotRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request UpdateSnapshotRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSnapshot

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateSnapshotRequest request = new UpdateSnapshotRequest
{
    Snapshot = new Snapshot(),
    UpdateMask = new FieldMask(),
};
// Make the request
Snapshot response = await subscriberServiceApiClient.UpdateSnapshotAsync(request);

UpdateSubscription(Subscription, FieldMask, CallSettings)

public virtual Subscription UpdateSubscription(Subscription subscription, FieldMask updateMask, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription Subscription

Required. The updated subscription object.

updateMask FieldMask

Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
Subscription subscription = new Subscription();
FieldMask updateMask = new FieldMask();
// Make the request
Subscription response = subscriberServiceApiClient.UpdateSubscription(subscription, updateMask);

UpdateSubscription(UpdateSubscriptionRequest, CallSettings)

public virtual Subscription UpdateSubscription(UpdateSubscriptionRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request UpdateSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Subscription

The RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = SubscriberServiceApiClient.Create();
// Initialize request argument(s)
UpdateSubscriptionRequest request = new UpdateSubscriptionRequest
{
    Subscription = new Subscription(),
    UpdateMask = new FieldMask(),
};
// Make the request
Subscription response = subscriberServiceApiClient.UpdateSubscription(request);

UpdateSubscriptionAsync(Subscription, FieldMask, CallSettings)

public virtual Task<Subscription> UpdateSubscriptionAsync(Subscription subscription, FieldMask updateMask, CallSettings callSettings = null)

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.

Parameters
Name Description
subscription Subscription

Required. The updated subscription object.

updateMask FieldMask

Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Subscription subscription = new Subscription();
FieldMask updateMask = new FieldMask();
// Make the request
Subscription response = await subscriberServiceApiClient.UpdateSubscriptionAsync(subscription, updateMask);

UpdateSubscriptionAsync(Subscription, FieldMask, CancellationToken)

public virtual Task<Subscription> UpdateSubscriptionAsync(Subscription subscription, FieldMask updateMask, CancellationToken cancellationToken)

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.

Parameters
Name Description
subscription Subscription

Required. The updated subscription object.

updateMask FieldMask

Required. Indicates which fields in the provided subscription to update. Must be specified and non-empty.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
Subscription subscription = new Subscription();
FieldMask updateMask = new FieldMask();
// Make the request
Subscription response = await subscriberServiceApiClient.UpdateSubscriptionAsync(subscription, updateMask);

UpdateSubscriptionAsync(UpdateSubscriptionRequest, CallSettings)

public virtual Task<Subscription> UpdateSubscriptionAsync(UpdateSubscriptionRequest request, CallSettings callSettings = null)

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.

Parameters
Name Description
request UpdateSubscriptionRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateSubscriptionRequest request = new UpdateSubscriptionRequest
{
    Subscription = new Subscription(),
    UpdateMask = new FieldMask(),
};
// Make the request
Subscription response = await subscriberServiceApiClient.UpdateSubscriptionAsync(request);

UpdateSubscriptionAsync(UpdateSubscriptionRequest, CancellationToken)

public virtual Task<Subscription> UpdateSubscriptionAsync(UpdateSubscriptionRequest request, CancellationToken cancellationToken)

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.

Parameters
Name Description
request UpdateSubscriptionRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskSubscription

A Task containing the RPC response.

Example
// Create client
SubscriberServiceApiClient subscriberServiceApiClient = await SubscriberServiceApiClient.CreateAsync();
// Initialize request argument(s)
UpdateSubscriptionRequest request = new UpdateSubscriptionRequest
{
    Subscription = new Subscription(),
    UpdateMask = new FieldMask(),
};
// Make the request
Subscription response = await subscriberServiceApiClient.UpdateSubscriptionAsync(request);