Interface DestinationResolver<T>

Type Parameters:
T - type of the records written by the sink
All Superinterfaces:
Serializable
All Known Implementing Classes:
FixedDestinationResolver
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Public @FunctionalInterface public interface DestinationResolver<T> extends Serializable
Resolves the destination table for each record, enabling one sink instance to write to many tables (dynamic destinations).

The resolver is invoked once per record on the hot write path, and before the serializer runs — a record the serializer then rejects is reported against the table it was headed for. Implementations must be deterministic and cheap; when destinations repeat, return cached TableDestination instances instead of re-creating them per record (for example via a small Map#computeIfAbsent keyed on the varying component).

In the bulk sink, each distinct table costs the writer a mutation batcher of its own, held until the destination goes idle; BigtableWriterOptions.destinationIdleTimeout bounds that state. The conditional surfaces instead retain per-table request state and share a client per instance, governed by BigtableRequestOptions. Resolver cardinality is a resource decision on both surfaces.

Sinks supply a SinkWriter.Context exposing the record's event timestamp for time-based routing. The conditional async helper supplies null; resolvers used there must obtain routing information from the element itself.

  • Method Summary

    Modifier and Type
    Method
    Description
    resolve(T element, org.apache.flink.api.connector.sink2.SinkWriter.Context context)
    Returns the destination table for the given record.
  • Method Details

    • resolve

      TableDestination resolve(T element, @Nullable org.apache.flink.api.connector.sink2.SinkWriter.Context context)
      Returns the destination table for the given record.
      Parameters:
      element - the record
      context - writer context exposing the record's event timestamp and current watermark, or null when invoked by the conditional async helper
      Returns:
      the destination table; never null