Class AsyncLookupRetries

java.lang.Object
io.github.flink.gcp.connector.base.table.AsyncLookupRetries

@Internal public final class AsyncLookupRetries extends Object
Retries an asynchronous Table API lookup and converts its successful result to rows. Read and conversion behavior and transient-failure classification belong to the connector (ADR-0039).

Callbacks run directly, without a helper-owned executor. A work counter turns an immediate failure's retry into a loop, so the retry budget cannot grow the calling thread's stack. Each invocation has its own counter, retry budget and result.

Cancellation of the returned future stops further retries but does not cancel an in-flight read. Flink's AsyncLookupFunction.eval and CachingAsyncLookupFunction chain completion without propagating cancellation to the lookup's future (Flink 1.20.4 and 2.2.1). The client futures also differ: Bigtable's classic point-read future supports upstream cancellation, while Spanner's single-row and Firestore's document futures do not wire cancellation to their streams (libraries-bom 26.90.0). The helper therefore carries no active-call cancellation handle.

  • Method Details

    • lookup

      public static <T> CompletableFuture<Collection<org.apache.flink.table.data.RowData>> lookup(Supplier<com.google.api.core.ApiFuture<T>> read, AsyncLookupRetries.RowConverter<T> converter, Predicate<Throwable> isRetryable, int maxRetries)
      Starts one read and retries classified failures up to maxRetries times after the initial attempt. A read that throws at once is handled like a failed future. Conversion failures complete the result exceptionally without another read.
      Type Parameters:
      T - the client library's read-result type
      Parameters:
      read - starts a new read of the same key on each call
      converter - converts the successful value, including a nullable missing-row value
      isRetryable - classifies read failures using the connector's policy
      maxRetries - the connector-validated non-negative number of retries
      Returns:
      the rows or the last read or conversion failure