Class CloudTasksCreateTaskSink<T>

java.lang.Object
io.github.flink.gcp.connector.cloudtasks.sink.CloudTasksCreateTaskSink<T>
Type Parameters:
T - type of the records written by the sink
All Implemented Interfaces:
CrossVersionSink<T>, Serializable, org.apache.flink.api.connector.sink2.Sink<T>, org.apache.flink.streaming.api.lineage.LineageVertexProvider

@Internal public class CloudTasksCreateTaskSink<T> extends Object implements CrossVersionSink<T>, org.apache.flink.streaming.api.lineage.LineageVertexProvider
At-least-once sink creating one Cloud Tasks task per record through the CreateTask RPC, with fixed or per-record queue destinations.
See Also:
  • Constructor Details

    • CloudTasksCreateTaskSink

      public CloudTasksCreateTaskSink(CloudTasksSinkConfig<T> config)
      Creates the sink; called by CloudTasksSinkBuilder.
      Parameters:
      config - the sink configuration
    • CloudTasksCreateTaskSink

      public CloudTasksCreateTaskSink(CloudTasksSinkConfig<T> config, @Nullable String logicalTableName)
      Creates a sink with the Table planner's logical identity, or DataStream metadata when absent.
      Parameters:
      config - the validated sink configuration
      logicalTableName - the catalog identifier, or null for a DataStream sink
  • Method Details

    • getLineageVertex

      public org.apache.flink.streaming.api.lineage.LineageVertex getLineageVertex()
      Specified by:
      getLineageVertex in interface org.apache.flink.streaming.api.lineage.LineageVertexProvider
    • getConfig

      public CloudTasksSinkConfig<T> getConfig()
      Returns the sink configuration.
    • createWriter

      public org.apache.flink.api.connector.sink2.SinkWriter<T> createWriter(org.apache.flink.api.connector.sink2.WriterInitContext context) throws IOException
      Specified by:
      createWriter in interface org.apache.flink.api.connector.sink2.Sink<T>
      Throws:
      IOException
    • taskCreatorFactory

      @VisibleForTesting public DefaultTaskCreatorFactory taskCreatorFactory()
      The factory the production path builds. A separate method so a test can assert the configuration actually reaches it — the wiring is three config lookups, and a dropped or swapped one compiles.
    • createWriter

      @VisibleForTesting public org.apache.flink.api.connector.sink2.SinkWriter<T> createWriter(TaskCreator creator, org.apache.flink.api.common.operators.MailboxExecutor mailboxExecutor, org.apache.flink.metrics.groups.SinkWriterMetricGroup metricGroup)
      Creates the writer against injected collaborators. Deliberately does not open the failure handler: opening belongs to the production path above, and a test driving this overload opens whatever it needs itself.