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 topic for each record, enabling one sink instance to publish to many topics (dynamic destinations).

The resolver is invoked once per record on the hot write path. Implementations must be deterministic and cheap; when destinations repeat, return cached TopicDestination instances instead of re-creating them per record (for example via a small Map#computeIfAbsent keyed on the varying component).

The SinkWriter.Context exposes the record's event timestamp for time-based routing.

  • Method Summary

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

    • resolve

      TopicDestination resolve(T element, org.apache.flink.api.connector.sink2.SinkWriter.Context context)
      Returns the destination topic for the given record.
      Parameters:
      element - the record
      context - writer context exposing the record's event timestamp and current watermark
      Returns:
      the destination topic; never null