Class SubscriberSettings.Builder (1.15.0)

public abstract static class SubscriberSettings.Builder

Inheritance

java.lang.Object > SubscriberSettings.Builder

Constructors

Builder()

public Builder()

Methods

build()

public abstract SubscriberSettings build()
Returns
Type Description
SubscriberSettings

setAssignmentServiceClient(PartitionAssignmentServiceClient client)

public abstract SubscriberSettings.Builder setAssignmentServiceClient(PartitionAssignmentServiceClient client)

A client to connect to the Pub/Sub lite assignment service. If present, ignores CredentialsProvider.

Parameter
Name Description
client PartitionAssignmentServiceClient
Returns
Type Description
SubscriberSettings.Builder

setCredentialsProvider(CredentialsProvider provider)

public abstract SubscriberSettings.Builder setCredentialsProvider(CredentialsProvider provider)

A provider for credentials.

Parameter
Name Description
provider CredentialsProvider
Returns
Type Description
SubscriberSettings.Builder

setCursorServiceClient(CursorServiceClient client)

public abstract SubscriberSettings.Builder setCursorServiceClient(CursorServiceClient client)

A CursorServiceClient to use, if present.

Parameter
Name Description
client CursorServiceClient
Returns
Type Description
SubscriberSettings.Builder

setFramework(PubsubContext.Framework framework)

public abstract SubscriberSettings.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
SubscriberSettings.Builder

setNackHandler(NackHandler nackHandler)

public abstract SubscriberSettings.Builder setNackHandler(NackHandler nackHandler)

A handler for the action to take when com.google.cloud.pubsub.v1.AckReplyConsumer#nack is called. In Pub/Sub Lite, only a single subscriber for a given subscription is connected to any partition at a time, and there is no other client that may be able to handle messages.

Parameter
Name Description
nackHandler NackHandler
Returns
Type Description
SubscriberSettings.Builder

setPartitions(List<Partition> partition)

public abstract SubscriberSettings.Builder setPartitions(List<Partition> partition)

The partitions this subscriber should connect to to receive messages. If set, disables auto-assignment.

Parameter
Name Description
partition List<Partition>
Returns
Type Description
SubscriberSettings.Builder

setPerPartitionFlowControlSettings(FlowControlSettings settings)

public abstract SubscriberSettings.Builder setPerPartitionFlowControlSettings(FlowControlSettings settings)

The per-partition flow control settings. Because these apply per-partition, if you are using them to bound memory usage, keep in mind the number of partitions in the associated topic.

Parameter
Name Description
settings FlowControlSettings
Returns
Type Description
SubscriberSettings.Builder

setReassignmentHandler(ReassignmentHandler reassignmentHandler)

public abstract SubscriberSettings.Builder setReassignmentHandler(ReassignmentHandler reassignmentHandler)

A handler that will be notified when partition assignments change from the backend.

Parameter
Name Description
reassignmentHandler ReassignmentHandler
Returns
Type Description
SubscriberSettings.Builder

setReceiver(MessageReceiver receiver)

public abstract SubscriberSettings.Builder setReceiver(MessageReceiver receiver)

The receiver which handles new messages sent by the Pub/Sub Lite system. Only one downcall from any connected partition will be outstanding at a time, and blocking in this receiver callback will block forward progress.

Parameter
Name Description
receiver com.google.cloud.pubsub.v1.MessageReceiver
Returns
Type Description
SubscriberSettings.Builder

setSubscriberServiceClient(SubscriberServiceClient client)

public abstract SubscriberSettings.Builder setSubscriberServiceClient(SubscriberServiceClient client)

A SubscriberServiceClient to use, if present.

Parameter
Name Description
client SubscriberServiceClient
Returns
Type Description
SubscriberSettings.Builder

setSubscriptionPath(SubscriptionPath path)

public abstract SubscriberSettings.Builder setSubscriptionPath(SubscriptionPath path)

The subscription to use to receive messages.

Parameter
Name Description
path SubscriptionPath
Returns
Type Description
SubscriberSettings.Builder

setTransformer(MessageTransformer<SequencedMessage,PubsubMessage> transformer)

public abstract SubscriberSettings.Builder setTransformer(MessageTransformer<SequencedMessage,PubsubMessage> transformer)

The MessageTransformer to get PubsubMessages from Pub/Sub Lite wire messages. The messageId field must not be set on the returned message.

Parameter
Name Description
transformer MessageTransformer<SequencedMessage,com.google.pubsub.v1.PubsubMessage>
Returns
Type Description
SubscriberSettings.Builder