Cloud Pub/Sub v1 API - Class Publisher.PublisherClient (3.12.0)

public class Publisher.PublisherClient : ClientBase<Publisher.PublisherClient>

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

Client for Publisher

Inheritance

object > ClientBase > ClientBasePublisherPublisherClient > Publisher.PublisherClient

Namespace

Google.Cloud.PubSub.V1

Assembly

Google.Cloud.PubSub.V1.dll

Constructors

PublisherClient()

protected PublisherClient()

Protected parameterless constructor to allow creation of test doubles.

PublisherClient(CallInvoker)

public PublisherClient(CallInvoker callInvoker)

Creates a new client for Publisher that uses a custom CallInvoker.

Parameter
Name Description
callInvoker CallInvoker

The callInvoker to use to make remote calls.

PublisherClient(ChannelBase)

public PublisherClient(ChannelBase channel)

Creates a new client for Publisher

Parameter
Name Description
channel ChannelBase

The channel to use to make remote calls.

PublisherClient(ClientBaseConfiguration)

protected PublisherClient(ClientBase.ClientBaseConfiguration configuration)

Protected constructor to allow creation of configured clients.

Parameter
Name Description
configuration ClientBaseClientBaseConfiguration

The client configuration.

Methods

CreateIAMPolicyClient()

public virtual IAMPolicy.IAMPolicyClient CreateIAMPolicyClient()

Creates a new instance of IAMPolicy.IAMPolicyClient using the same call invoker as this client.

Returns
Type Description
IAMPolicyIAMPolicyClient

A new IAMPolicy.IAMPolicyClient for the same target as this client.

CreateTopic(Topic, CallOptions)

public virtual Topic CreateTopic(Topic request, CallOptions options)

Creates the given topic with the given name. See the resource name rules.

Parameters
Name Description
request Topic

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
Topic

The response received from the server.

CreateTopic(Topic, Metadata, DateTime?, CancellationToken)

public virtual Topic CreateTopic(Topic request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Creates the given topic with the given name. See the resource name rules.

Parameters
Name Description
request Topic

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
Topic

The response received from the server.

CreateTopicAsync(Topic, CallOptions)

public virtual AsyncUnaryCall<Topic> CreateTopicAsync(Topic request, CallOptions options)

Creates the given topic with the given name. See the resource name rules.

Parameters
Name Description
request Topic

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.

CreateTopicAsync(Topic, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<Topic> CreateTopicAsync(Topic request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Creates the given topic with the given name. See the resource name rules.

Parameters
Name Description
request Topic

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.

DeleteTopic(DeleteTopicRequest, CallOptions)

public virtual Empty DeleteTopic(DeleteTopicRequest request, CallOptions options)

Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their topic field is set to _deleted-topic_.

Parameters
Name Description
request DeleteTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
Empty

The response received from the server.

DeleteTopic(DeleteTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual Empty DeleteTopic(DeleteTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their topic field is set to _deleted-topic_.

Parameters
Name Description
request DeleteTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
Empty

The response received from the server.

DeleteTopicAsync(DeleteTopicRequest, CallOptions)

public virtual AsyncUnaryCall<Empty> DeleteTopicAsync(DeleteTopicRequest request, CallOptions options)

Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their topic field is set to _deleted-topic_.

Parameters
Name Description
request DeleteTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallEmpty

The call object.

DeleteTopicAsync(DeleteTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<Empty> DeleteTopicAsync(DeleteTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Deletes the topic with the given name. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name; this is an entirely new topic with none of the old configuration or subscriptions. Existing subscriptions to this topic are not deleted, but their topic field is set to _deleted-topic_.

Parameters
Name Description
request DeleteTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallEmpty

The call object.

DetachSubscription(DetachSubscriptionRequest, CallOptions)

public virtual DetachSubscriptionResponse DetachSubscription(DetachSubscriptionRequest request, CallOptions options)

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent Pull and StreamingPull requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

Parameters
Name Description
request DetachSubscriptionRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
DetachSubscriptionResponse

The response received from the server.

DetachSubscription(DetachSubscriptionRequest, Metadata, DateTime?, CancellationToken)

public virtual DetachSubscriptionResponse DetachSubscription(DetachSubscriptionRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent Pull and StreamingPull requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

Parameters
Name Description
request DetachSubscriptionRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
DetachSubscriptionResponse

The response received from the server.

DetachSubscriptionAsync(DetachSubscriptionRequest, CallOptions)

public virtual AsyncUnaryCall<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, CallOptions options)

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent Pull and StreamingPull requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

Parameters
Name Description
request DetachSubscriptionRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallDetachSubscriptionResponse

The call object.

DetachSubscriptionAsync(DetachSubscriptionRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<DetachSubscriptionResponse> DetachSubscriptionAsync(DetachSubscriptionRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent Pull and StreamingPull requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.

Parameters
Name Description
request DetachSubscriptionRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallDetachSubscriptionResponse

The call object.

GetTopic(GetTopicRequest, CallOptions)

public virtual Topic GetTopic(GetTopicRequest request, CallOptions options)

Gets the configuration of a topic.

Parameters
Name Description
request GetTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
Topic

The response received from the server.

GetTopic(GetTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual Topic GetTopic(GetTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Gets the configuration of a topic.

Parameters
Name Description
request GetTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
Topic

The response received from the server.

GetTopicAsync(GetTopicRequest, CallOptions)

public virtual AsyncUnaryCall<Topic> GetTopicAsync(GetTopicRequest request, CallOptions options)

Gets the configuration of a topic.

Parameters
Name Description
request GetTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.

GetTopicAsync(GetTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<Topic> GetTopicAsync(GetTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Gets the configuration of a topic.

Parameters
Name Description
request GetTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.

ListTopicSnapshots(ListTopicSnapshotsRequest, CallOptions)

public virtual ListTopicSnapshotsResponse ListTopicSnapshots(ListTopicSnapshotsRequest request, CallOptions options)

Lists the names of the snapshots on this topic. 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 ListTopicSnapshotsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
ListTopicSnapshotsResponse

The response received from the server.

ListTopicSnapshots(ListTopicSnapshotsRequest, Metadata, DateTime?, CancellationToken)

public virtual ListTopicSnapshotsResponse ListTopicSnapshots(ListTopicSnapshotsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists the names of the snapshots on this topic. 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 ListTopicSnapshotsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
ListTopicSnapshotsResponse

The response received from the server.

ListTopicSnapshotsAsync(ListTopicSnapshotsRequest, CallOptions)

public virtual AsyncUnaryCall<ListTopicSnapshotsResponse> ListTopicSnapshotsAsync(ListTopicSnapshotsRequest request, CallOptions options)

Lists the names of the snapshots on this topic. 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 ListTopicSnapshotsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallListTopicSnapshotsResponse

The call object.

ListTopicSnapshotsAsync(ListTopicSnapshotsRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<ListTopicSnapshotsResponse> ListTopicSnapshotsAsync(ListTopicSnapshotsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists the names of the snapshots on this topic. 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 ListTopicSnapshotsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallListTopicSnapshotsResponse

The call object.

ListTopicSubscriptions(ListTopicSubscriptionsRequest, CallOptions)

public virtual ListTopicSubscriptionsResponse ListTopicSubscriptions(ListTopicSubscriptionsRequest request, CallOptions options)

Lists the names of the attached subscriptions on this topic.

Parameters
Name Description
request ListTopicSubscriptionsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
ListTopicSubscriptionsResponse

The response received from the server.

ListTopicSubscriptions(ListTopicSubscriptionsRequest, Metadata, DateTime?, CancellationToken)

public virtual ListTopicSubscriptionsResponse ListTopicSubscriptions(ListTopicSubscriptionsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists the names of the attached subscriptions on this topic.

Parameters
Name Description
request ListTopicSubscriptionsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
ListTopicSubscriptionsResponse

The response received from the server.

ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest, CallOptions)

public virtual AsyncUnaryCall<ListTopicSubscriptionsResponse> ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest request, CallOptions options)

Lists the names of the attached subscriptions on this topic.

Parameters
Name Description
request ListTopicSubscriptionsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallListTopicSubscriptionsResponse

The call object.

ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<ListTopicSubscriptionsResponse> ListTopicSubscriptionsAsync(ListTopicSubscriptionsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists the names of the attached subscriptions on this topic.

Parameters
Name Description
request ListTopicSubscriptionsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallListTopicSubscriptionsResponse

The call object.

ListTopics(ListTopicsRequest, CallOptions)

public virtual ListTopicsResponse ListTopics(ListTopicsRequest request, CallOptions options)

Lists matching topics.

Parameters
Name Description
request ListTopicsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
ListTopicsResponse

The response received from the server.

ListTopics(ListTopicsRequest, Metadata, DateTime?, CancellationToken)

public virtual ListTopicsResponse ListTopics(ListTopicsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists matching topics.

Parameters
Name Description
request ListTopicsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
ListTopicsResponse

The response received from the server.

ListTopicsAsync(ListTopicsRequest, CallOptions)

public virtual AsyncUnaryCall<ListTopicsResponse> ListTopicsAsync(ListTopicsRequest request, CallOptions options)

Lists matching topics.

Parameters
Name Description
request ListTopicsRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallListTopicsResponse

The call object.

ListTopicsAsync(ListTopicsRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<ListTopicsResponse> ListTopicsAsync(ListTopicsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Lists matching topics.

Parameters
Name Description
request ListTopicsRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallListTopicsResponse

The call object.

NewInstance(ClientBaseConfiguration)

protected override Publisher.PublisherClient NewInstance(ClientBase.ClientBaseConfiguration configuration)

Creates a new instance of client from given ClientBaseConfiguration.

Parameter
Name Description
configuration ClientBaseClientBaseConfiguration
Returns
Type Description
PublisherPublisherClient
Overrides

Publish(PublishRequest, CallOptions)

public virtual PublishResponse Publish(PublishRequest request, CallOptions options)

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

Parameters
Name Description
request PublishRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
PublishResponse

The response received from the server.

Publish(PublishRequest, Metadata, DateTime?, CancellationToken)

public virtual PublishResponse Publish(PublishRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

Parameters
Name Description
request PublishRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
PublishResponse

The response received from the server.

PublishAsync(PublishRequest, CallOptions)

public virtual AsyncUnaryCall<PublishResponse> PublishAsync(PublishRequest request, CallOptions options)

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

Parameters
Name Description
request PublishRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallPublishResponse

The call object.

PublishAsync(PublishRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<PublishResponse> PublishAsync(PublishRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Adds one or more messages to the topic. Returns NOT_FOUND if the topic does not exist.

Parameters
Name Description
request PublishRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallPublishResponse

The call object.

UpdateTopic(UpdateTopicRequest, CallOptions)

public virtual Topic UpdateTopic(UpdateTopicRequest request, CallOptions options)

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

Parameters
Name Description
request UpdateTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
Topic

The response received from the server.

UpdateTopic(UpdateTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual Topic UpdateTopic(UpdateTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

Parameters
Name Description
request UpdateTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
Topic

The response received from the server.

UpdateTopicAsync(UpdateTopicRequest, CallOptions)

public virtual AsyncUnaryCall<Topic> UpdateTopicAsync(UpdateTopicRequest request, CallOptions options)

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

Parameters
Name Description
request UpdateTopicRequest

The request to send to the server.

options CallOptions

The options for the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.

UpdateTopicAsync(UpdateTopicRequest, Metadata, DateTime?, CancellationToken)

public virtual AsyncUnaryCall<Topic> UpdateTopicAsync(UpdateTopicRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

Updates an existing topic by updating the fields specified in the update mask. Note that certain properties of a topic are not modifiable.

Parameters
Name Description
request UpdateTopicRequest

The request to send to the server.

headers Metadata

The initial metadata to send with the call. This parameter is optional.

deadline System.DateTime

An optional deadline for the call. The call will be cancelled if deadline is hit.

cancellationToken CancellationToken

An optional token for canceling the call.

Returns
Type Description
AsyncUnaryCallTopic

The call object.