Cloud Pub/Sub v1 API - Class PublisherClientBuilder (3.6.0)

public sealed class PublisherClientBuilder : ClientBuilderBase<PublisherClient>

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

Builder class for PublisherClient to provide simple configuration of credentials, endpoint, client count, publication settings etc.

Inheritance

object > ClientBuilderBasePublisherClient > PublisherClientBuilder

Namespace

Google.Cloud.PubSub.V1

Assembly

Google.Cloud.PubSub.V1.dll

Constructors

PublisherClientBuilder()

public PublisherClientBuilder()

Creates a new instance with default settings. TopicName must be set before calling either Build() or BuildAsync(CancellationToken).

Properties

ApiSettings

public PublisherServiceApiSettings ApiSettings { get; set; }

The settings to use when creatingPublisherServiceApiClient instances. Default settings will be used if this is null.

Property Value
TypeDescription
PublisherServiceApiSettings

ClientCount

public int? ClientCount { get; set; }

The number of PublisherServiceApiClients to create and use within a PublisherClient instance. If this is null, the number of clients created will depend on the processor count.

Property Value
TypeDescription
int

EmulatorDetection

public EmulatorDetection EmulatorDetection { get; set; }

Specifies how to respond to the presence of emulator environment variables.

Property Value
TypeDescription
EmulatorDetection
Remarks

This property defaults to None, meaning that environment variables are ignored.

Settings

public PublisherClient.Settings Settings { get; set; }

Additional settings for batching, message ordering etc. Default settings will be used if this is null.

Property Value
TypeDescription
PublisherClientSettings

TopicName

public TopicName TopicName { get; set; }

The name of the topic that the publisher publishes to. This must be non-null by the time Build() or BuildAsync(CancellationToken) is called.

Property Value
TypeDescription
TopicName

Methods

Build()

public override PublisherClient Build()

Builds the resulting client.

Returns
TypeDescription
PublisherClient
Overrides
Google.Api.Gax.Grpc.ClientBuilderBase<Google.Cloud.PubSub.V1.PublisherClient>.Build()

BuildAsync(CancellationToken)

public override Task<PublisherClient> BuildAsync(CancellationToken cancellationToken = default)

Builds the resulting client asynchronously.

Parameter
NameDescription
cancellationTokenCancellationToken
Returns
TypeDescription
TaskPublisherClient
Overrides

GetChannelPool()

protected override ChannelPool GetChannelPool()
Returns
TypeDescription
ChannelPool
Overrides
Google.Api.Gax.Grpc.ClientBuilderBase<Google.Cloud.PubSub.V1.PublisherClient>.GetChannelPool()

Validate()

protected override void Validate()
Overrides
Google.Api.Gax.Grpc.ClientBuilderBase<Google.Cloud.PubSub.V1.PublisherClient>.Validate()