Class CloudTasksWriterOptions.Builder
- Enclosing class:
- CloudTasksWriterOptions
CloudTasksWriterOptions.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the options.channelPoolSize(int channelPoolSize) Sizes the client's gRPC channel pool.maxInFlightTasks(int maxInFlightTasks) Caps the task creations the writer keeps outstanding — those in flight plus those waiting out a retry backoff.notFoundRecoveryInitialBackoff(Duration notFoundRecoveryInitialBackoff) Sets the first backoff of theNOT_FOUNDretry.notFoundRecoveryMaxAttempts(int notFoundRecoveryMaxAttempts) Caps the attempts of theNOT_FOUNDretry, the initial creation included.notFoundRecoveryMaxBackoff(Duration notFoundRecoveryMaxBackoff) Caps the backoff of theNOT_FOUNDretry.perDestinationMetrics(boolean perDestinationMetrics) Registers per-queuerecordsSendandsendErrorscounters beside the writer's totals.recoveryInitialBackoff(Duration recoveryInitialBackoff) Sets the first backoff of the transient-failure retry (UNAVAILABLE,DEADLINE_EXCEEDED,RESOURCE_EXHAUSTED).recoveryMaxAttempts(int recoveryMaxAttempts) Caps the attempts of the transient-failure retry, the initial creation included.recoveryMaxBackoff(Duration recoveryMaxBackoff) Caps the backoff of the transient-failure retry.
-
Method Details
-
maxInFlightTasks
Caps the task creations the writer keeps outstanding — those in flight plus those waiting out a retry backoff. A write at the cap yields to the task mailbox until creations complete, bounding sink memory between checkpoints. Defaults to 1000.- Parameters:
maxInFlightTasks- the in-flight cap, positive- Returns:
- this builder
-
channelPoolSize
Sizes the client's gRPC channel pool. Unset by default, leaving the client's own transport configuration — one channel — alone.One HTTP/2 channel carries about 100 concurrent streams, so the default transport delivers only ~100 of the in-flight cap's nominal concurrency no matter how high the cap is set; a subtask that needs more concurrent creates than that needs more channels, about one per 100 concurrent creates. Raising it can push a single subtask past the queue's recommended ~1,000 TPS ceiling — mind the documented ramp guidance before doing so. Rejected in combination with an emulator endpoint when the sink is built: the emulator always uses one plaintext channel, so the pool would be silently ignored.
- Parameters:
channelPoolSize- the number of gRPC channels, positive- Returns:
- this builder
-
recoveryInitialBackoff
Sets the first backoff of the transient-failure retry (UNAVAILABLE,DEADLINE_EXCEEDED,RESOURCE_EXHAUSTED). Defaults to 100 ms.- Parameters:
recoveryInitialBackoff- the first backoff, at least 1 ms- Returns:
- this builder
-
recoveryMaxBackoff
Caps the backoff of the transient-failure retry. Defaults to 10 s.- Parameters:
recoveryMaxBackoff- the backoff cap, at least 1 ms and at least the initial backoff- Returns:
- this builder
-
recoveryMaxAttempts
Caps the attempts of the transient-failure retry, the initial creation included. Defaults to 8; exhausting the budget fails the job.- Parameters:
recoveryMaxAttempts- the maximum attempts, positive- Returns:
- this builder
-
notFoundRecoveryInitialBackoff
public CloudTasksWriterOptions.Builder notFoundRecoveryInitialBackoff(Duration notFoundRecoveryInitialBackoff) Sets the first backoff of theNOT_FOUNDretry. Defaults to 500 ms.- Parameters:
notFoundRecoveryInitialBackoff- the first backoff, at least 1 ms- Returns:
- this builder
-
notFoundRecoveryMaxBackoff
public CloudTasksWriterOptions.Builder notFoundRecoveryMaxBackoff(Duration notFoundRecoveryMaxBackoff) Caps the backoff of theNOT_FOUNDretry. Defaults to 2 s.- Parameters:
notFoundRecoveryMaxBackoff- the backoff cap, at least 1 ms and at least the initial backoff- Returns:
- this builder
-
notFoundRecoveryMaxAttempts
Caps the attempts of theNOT_FOUNDretry, the initial creation included. Defaults to 3: long enough to ride out a queue that is briefly unavailable, short enough that a mistyped queue name fails quickly. A queue that takes minutes to re-activate outlives this budget on purpose — recovering from that is the job's restart strategy, not the writer's.- Parameters:
notFoundRecoveryMaxAttempts- the maximum attempts, positive- Returns:
- this builder
-
perDestinationMetrics
Registers per-queuerecordsSendandsendErrorscounters beside the writer's totals. Defaults tofalse.Off by default because Flink cannot unregister a metric: with a per-record
destinationResolverthe queue set is unbounded, so every queue the job ever writes to keeps a row in the metric registry for the lifetime of the task. Switch it on for a sink whose queues are few and known — a fixedqueue(...)especially.- Parameters:
perDestinationMetrics- whether to register per-queue counters- Returns:
- this builder
-
build
Builds the options.- Returns:
- the options
-