Class CloudTasksSink

java.lang.Object
io.github.flink.gcp.connector.cloudtasks.sink.CloudTasksSink

@Public public final class CloudTasksSink extends Object
Entry point for building a Cloud Tasks sink.

The sink creates one HTTP task per record, at-least-once, and flushes every outstanding creation at each checkpoint barrier. Dispatch pacing is not configured here: Cloud Tasks paces execution on the queue, so the queue's rate limits and retry policy — applied by whoever created it — decide how fast the tasks run. The sink only decides how fast tasks are handed over.

That at-least-once statement assumes the default FailureHandler.failJob() policy. Under a dropping policy configured through CloudTasksSinkBuilder.failedTaskHandler(FailureHandler), a completed checkpoint means every record up to the barrier was either durably accepted, skipped by the serializer, or handed to that handler.

Example:


 Sink<OrderEvent> sink =
         CloudTasksSink.<OrderEvent>builder()
                 .queue(QueueDestination.of("my-project", "asia-northeast1", "webhooks"))
                 .serializer(
                         CloudTasksSerializationSchema.httpTarget(
                                         "https://api.example.com/v1/orders")
                                 .withBody(new MyEventJsonSerializationSchema())
                                 .withHeaders(
                                         e -> Map.of("Content-Type", "application/json"))
                                 .withOidcToken(
                                         "dispatcher@my-project.iam.gserviceaccount.com"))
                 .build();