in flink-connector/flink-connector-gcp-pubsub/src/main/java/com/google/pubsub/flink/PubSubSource.java [224:287]
public abstract Builder<OutputT> setDeserializationSchema(
PubSubDeserializationSchema<OutputT> deserializationSchema);
/**
* Sets the max number of messages that can be outstanding to a StreamingPull connection.
*
* <p>Defaults to 1,000 outstanding messages. A message is considered outstanding when it is
* delivered and waiting to be acknowledged in the next successful checkpoint. Google Cloud
* Pub/Sub suspends message delivery to StreamingPull connections that reach this limit.
*
* <p>If set, this value must be > 0. Otherwise, calling {@link build} will throw an exception.
*/
public abstract Builder<OutputT> setMaxOutstandingMessagesCount(Long count);
/**
* Sets the max cumulative message bytes that can be outstanding to a StreamingPull connection.
*
* <p>Defaults to 100 MB. A message is considered outstanding when it is delivered and waiting
* to be acknowledged in the next successful checkpoint. Google Cloud Pub/Sub suspends message
* delivery to StreamingPull connections that reach this limit.
*
* <p>If set, this value must be > 0. Otherwise, calling {@link build} will throw an exception.
*/
public abstract Builder<OutputT> setMaxOutstandingMessagesBytes(Long bytes);
/**
* Sets the number of StreamingPull connections opened by each {@link PubSubSource} subtask.
*
* <p>Defaults to 1.
*
* <p>If set, this value must be > 0. Otherwise, calling {@link build} will throw an exception.
*/
public abstract Builder<OutputT> setParallelPullCount(Integer parallelPullCount);
/**
* Sets the credentials used when pulling messages from Google Cloud Pub/Sub.
*
* <p>If not set, then Application Default Credentials are used for authentication.
*/
public abstract Builder<OutputT> setCredentials(Credentials credentials);
/**
* Sets the Google Cloud Pub/Sub service endpoint from which messages are pulled.
*
* <p>Defaults to connecting to the global endpoint, which routes requests to the nearest
* regional endpoint.
*/
public abstract Builder<OutputT> setEndpoint(String endpoint);
abstract PubSubSource<OutputT> autoBuild();
public final PubSubSource<OutputT> build() {
PubSubSource<OutputT> source = autoBuild();
Preconditions.checkArgument(
source.maxOutstandingMessagesCount().or(1L) > 0,
"maxOutstandingMessagesCount, if set, must be a value greater than 0.");
Preconditions.checkArgument(
source.maxOutstandingMessagesBytes().or(1L) > 0,
"maxOutstandingMessagesBytes, if set, must be a value greater than 0.");
Preconditions.checkArgument(
source.parallelPullCount().or(1) > 0,
"parallelPullCount, if set, must be a value greater than 0.");
return source;
}