Class PublisherSettings.Builder (1.14.2)

public abstract static class PublisherSettings.Builder

Inheritance

java.lang.Object > PublisherSettings.Builder

Constructors

Builder()

public Builder()

Methods

build()

public abstract PublisherSettings build()
Returns
Type Description
PublisherSettings

setAdminClient(AdminClient adminClient)

public abstract PublisherSettings.Builder setAdminClient(AdminClient adminClient)

The AdminClient to use, if provided.

Parameter
Name Description
adminClient AdminClient
Returns
Type Description
PublisherSettings.Builder

setBatchingSettings(BatchingSettings batchingSettings)

public abstract PublisherSettings.Builder setBatchingSettings(BatchingSettings batchingSettings)

Batching settings for this publisher to use. Apply per-partition.

Parameter
Name Description
batchingSettings BatchingSettings
Returns
Type Description
PublisherSettings.Builder

setCredentialsProvider(CredentialsProvider credentialsProvider)

public abstract PublisherSettings.Builder setCredentialsProvider(CredentialsProvider credentialsProvider)

A provider for credentials.

Parameter
Name Description
credentialsProvider CredentialsProvider
Returns
Type Description
PublisherSettings.Builder

setEnableCompression(boolean enableCompression)

public abstract PublisherSettings.Builder setEnableCompression(boolean enableCompression)

Whether request compression is enabled. Default true.

Parameter
Name Description
enableCompression boolean
Returns
Type Description
PublisherSettings.Builder

setEnableIdempotence(boolean enableIdempotence)

public abstract PublisherSettings.Builder setEnableIdempotence(boolean enableIdempotence)

Whether idempotence is enabled, where the server will ensure that unique messages within a single publisher session are stored only once. Default true.

Parameter
Name Description
enableIdempotence boolean
Returns
Type Description
PublisherSettings.Builder

setFramework(PubsubContext.Framework framework)

public abstract PublisherSettings.Builder setFramework(PubsubContext.Framework framework)

A Framework tag for internal metrics. Please set this if integrating with a public framework!

Parameter
Name Description
framework PubsubContext.Framework
Returns
Type Description
PublisherSettings.Builder

setKeyExtractor(KeyExtractor keyExtractor)

public abstract PublisherSettings.Builder setKeyExtractor(KeyExtractor keyExtractor)

A KeyExtractor for getting the routing key from a message.

Parameter
Name Description
keyExtractor KeyExtractor
Returns
Type Description
PublisherSettings.Builder

setMessageTransformer(MessageTransformer<PubsubMessage,Message> messageTransformer)

public abstract PublisherSettings.Builder setMessageTransformer(MessageTransformer<PubsubMessage,Message> messageTransformer)

A MessageTransformer for constructing wire messages from Cloud Pub/Sub PubsubMessages.

Parameter
Name Description
messageTransformer MessageTransformer<com.google.pubsub.v1.PubsubMessage,Message>
Returns
Type Description
PublisherSettings.Builder

setServiceClient(PublisherServiceClient client)

public abstract PublisherSettings.Builder setServiceClient(PublisherServiceClient client)

The PublisherServiceClient to use, if provided.

Parameter
Name Description
client PublisherServiceClient
Returns
Type Description
PublisherSettings.Builder

setTopicPath(TopicPath path)

public abstract PublisherSettings.Builder setTopicPath(TopicPath path)

The topic path to publish to.

Parameter
Name Description
path TopicPath
Returns
Type Description
PublisherSettings.Builder