Class PublisherSettings.Builder (1.13.0)

public abstract static class PublisherSettings.Builder

Inheritance

java.lang.Object > PublisherSettings.Builder

Constructors

Builder()

public Builder()

Methods

build()

public abstract PublisherSettings build()
Returns
TypeDescription
PublisherSettings

setAdminClient(AdminClient adminClient)

public abstract PublisherSettings.Builder setAdminClient(AdminClient adminClient)

The AdminClient to use, if provided.

Parameter
NameDescription
adminClientAdminClient
Returns
TypeDescription
PublisherSettings.Builder

setBatchingSettings(BatchingSettings batchingSettings)

public abstract PublisherSettings.Builder setBatchingSettings(BatchingSettings batchingSettings)

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

Parameter
NameDescription
batchingSettingsBatchingSettings
Returns
TypeDescription
PublisherSettings.Builder

setCredentialsProvider(CredentialsProvider credentialsProvider)

public abstract PublisherSettings.Builder setCredentialsProvider(CredentialsProvider credentialsProvider)

A provider for credentials.

Parameter
NameDescription
credentialsProviderCredentialsProvider
Returns
TypeDescription
PublisherSettings.Builder

setEnableCompression(boolean enableCompression)

public abstract PublisherSettings.Builder setEnableCompression(boolean enableCompression)

Whether request compression is enabled. Default true.

Parameter
NameDescription
enableCompressionboolean
Returns
TypeDescription
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
NameDescription
enableIdempotenceboolean
Returns
TypeDescription
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
NameDescription
frameworkPubsubContext.Framework
Returns
TypeDescription
PublisherSettings.Builder

setKeyExtractor(KeyExtractor keyExtractor)

public abstract PublisherSettings.Builder setKeyExtractor(KeyExtractor keyExtractor)

A KeyExtractor for getting the routing key from a message.

Parameter
NameDescription
keyExtractorKeyExtractor
Returns
TypeDescription
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
NameDescription
messageTransformerMessageTransformer<com.google.pubsub.v1.PubsubMessage,Message>
Returns
TypeDescription
PublisherSettings.Builder

setServiceClient(PublisherServiceClient client)

public abstract PublisherSettings.Builder setServiceClient(PublisherServiceClient client)

The PublisherServiceClient to use, if provided.

Parameter
NameDescription
clientPublisherServiceClient
Returns
TypeDescription
PublisherSettings.Builder

setTopicPath(TopicPath path)

public abstract PublisherSettings.Builder setTopicPath(TopicPath path)

The topic path to publish to.

Parameter
NameDescription
pathTopicPath
Returns
TypeDescription
PublisherSettings.Builder