Class FixedDestinationResolver

java.lang.Object
io.github.flink.gcp.connector.bigquery.sink.FixedDestinationResolver
All Implemented Interfaces:
DestinationResolver<Object>, Serializable

@Internal public final class FixedDestinationResolver extends Object implements DestinationResolver<Object>
A DestinationResolver returning one fixed destination for every record.

A named class (instead of a synthesized lambda) for two reasons: lambda serialization would tie the job graph to fragile SerializedLambda synthetic-method identity across connector versions, and writers can detect the single-destination case (via instanceof and getDestination()) to skip per-record destination resolution entirely.

See Also:
  • Constructor Details

    • FixedDestinationResolver

      public FixedDestinationResolver(TableDestination destination)
      Creates a resolver returning the given destination for every record.
      Parameters:
      destination - the destination table
  • Method Details

    • getDestination

      public TableDestination getDestination()
      Returns the fixed destination.
    • resolve

      public TableDestination resolve(Object element, org.apache.flink.api.connector.sink2.SinkWriter.Context context)
      Description copied from interface: DestinationResolver
      Resolves the destination for the given record.
      Specified by:
      resolve in interface DestinationResolver<Object>
      Parameters:
      element - the record
      context - writer context exposing the record's event timestamp and current watermark
      Returns:
      a destination table, or an explicit record-specific routing failure; never null