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
NameDescription
callInvokerCallInvoker

The callInvoker to use to make remote calls.

PublisherClient(ChannelBase)

public PublisherClient(ChannelBase channel)

Creates a new client for Publisher

Parameter
NameDescription
channelChannelBase

The channel to use to make remote calls.

PublisherClient(ClientBaseConfiguration)

protected PublisherClient(ClientBase.ClientBaseConfiguration configuration)

Protected constructor to allow creation of configured clients.

Parameter
NameDescription
configurationClientBaseClientBaseConfiguration

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
TypeDescription
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
NameDescription
requestTopic

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestTopic

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestTopic

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestTopic

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestDeleteTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestDeleteTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestDeleteTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestDeleteTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestDetachSubscriptionRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
AsyncUnaryCallDetachSubscriptionResponse

The call object.

GetTopic(GetTopicRequest, CallOptions)

public virtual Topic GetTopic(GetTopicRequest request, CallOptions options)

Gets the configuration of a topic.

Parameters
NameDescription
requestGetTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestGetTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestGetTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestGetTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSnapshotsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSnapshotsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSnapshotsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSnapshotsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSubscriptionsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSubscriptionsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSubscriptionsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicSubscriptionsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
AsyncUnaryCallListTopicSubscriptionsResponse

The call object.

ListTopics(ListTopicsRequest, CallOptions)

public virtual ListTopicsResponse ListTopics(ListTopicsRequest request, CallOptions options)

Lists matching topics.

Parameters
NameDescription
requestListTopicsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
ListTopicsResponse

The response received from the server.

ListTopicsAsync(ListTopicsRequest, CallOptions)

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

Lists matching topics.

Parameters
NameDescription
requestListTopicsRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestListTopicsRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
AsyncUnaryCallListTopicsResponse

The call object.

NewInstance(ClientBaseConfiguration)

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

Creates a new instance of client from given ClientBaseConfiguration.

Parameter
NameDescription
configurationClientBaseClientBaseConfiguration
Returns
TypeDescription
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
NameDescription
requestPublishRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestPublishRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestPublishRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestPublishRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestUpdateTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestUpdateTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
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
NameDescription
requestUpdateTopicRequest

The request to send to the server.

optionsCallOptions

The options for the call.

Returns
TypeDescription
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
NameDescription
requestUpdateTopicRequest

The request to send to the server.

headersMetadata

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

deadlineSystem.DateTime

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

cancellationTokenCancellationToken

An optional token for canceling the call.

Returns
TypeDescription
AsyncUnaryCallTopic

The call object.