Class ConfluentTools

java.lang.Object
io.confluent.flink.plugin.ConfluentTools

public class ConfluentTools extends Object
Various tools that help developing and testing Table API programs on Confluent Cloud.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static List<Row>
    Executes the given table transformations on Confluent Cloud and returns the results locally as a list of changelog rows.
    static List<Row>
    collectChangelog(Table table, int stopAfter)
    Executes the given table transformations on Confluent Cloud and returns the results locally as a list of changelog rows.
    static List<Row>
    Returns the given table results locally as a list of changelog rows.
    static List<Row>
    collectChangelog(TableResult tableResult, int stopAfter)
    Returns the given table results locally as a list of changelog rows.
    static List<Row>
    Executes the given table transformations on Confluent Cloud and returns the results locally as a materialized changelog.
    static List<Row>
    collectMaterialized(Table table, int stopAfter)
    Executes the given table transformations on Confluent Cloud and returns the results locally as a materialized changelog.
    static List<Row>
    Returns the given results locally as a materialized changelog.
    static List<Row>
    collectMaterialized(TableResult tableResult, int stopAfter)
    Returns the given results locally as a materialized changelog.
    static void
    Deletes the artifact with the given id (e.g.
    static void
    Deletes the statement behind the given statement name, blocking until the deletion completes or the configured timeout (client.timeout) elapses.
    static void
    deleteStatement(TableEnvironment env, String statementName, boolean await)
    Deletes the statement behind the given statement name, optionally waiting for the deletion to complete before returning.
    Returns a StatementHandle to manage a submitted Flink SQL statement on Confluent Cloud.
    Returns a StatementHandle to manage a submitted Flink SQL statement on Confluent Cloud.
    static String
    Returns the statement name behind the given table result.
    static void
    Executes the given table transformations on Confluent Cloud and prints the results locally as a table prefixed with a change flag column.
    static void
    printChangelog(Table table, int stopAfter)
    Executes the given table transformations on Confluent Cloud and prints the results locally as a table prefixed with a change flag column.
    static void
    Prints the results locally as a table prefixed with a change flag column.
    static void
    printChangelog(TableResult tableResult, int stopAfter)
    Prints the given table results locally as a table prefixed with a change flag column.
    static void
    Executes the given table transformations on Confluent Cloud and prints the results locally as a materialized changelog.
    static void
    printMaterialized(Table table, int stopAfter)
    Executes the given table transformations on Confluent Cloud and prints the results locally as a materialized changelog.
    static void
    Prints the given table results locally as a materialized changelog.
    static void
    printMaterialized(TableResult tableResult, int stopAfter)
    Prints the given table results locally as a materialized changelog.
    static void
    Resumes the statement behind the given statement name, blocking until the statement resumes or the configured timeout (client.timeout) elapses.
    static void
    resumeStatement(TableEnvironment env, String statementName, boolean await)
    Resumes the statement behind the given statement name, optionally waiting for the statement to resume before returning.
    static void
    Sets the statement name for the next statement submission.
    static void
    stopStatement(TableEnvironment env, String statementName)
    Stops the statement behind the given statement name, blocking until the statement reaches a stopped state or the configured timeout (client.timeout) elapses.
    static void
    stopStatement(TableEnvironment env, String statementName, boolean await)
    Stops the statement behind the given statement name, optionally waiting for the statement to reach a stopped state before returning.
    static void
    Stops the statement behind the given table result, blocking until the statement reaches a stopped state or the configured timeout (client.timeout) elapses.
    static void
    stopStatement(TableResult tableResult, boolean await)
    Stops the statement behind the given table result, optionally waiting for the statement to reach a stopped state before returning.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfluentTools

      public ConfluentTools()
  • Method Details

    • setStatementName

      public static void setStatementName(TableEnvironment env, String name)
      Sets the statement name for the next statement submission.

      A statement name must be unique within an environment and cloud region for a given organization. By default, statement names are auto-generated using a UUID.

      Important: If you configured an application name via ConfluentSettings.Builder.setApplicationName(String), it will be automatically prefixed to the statement name you provide here. For example, if your application name is "myapp" and you set the statement name to "query1", the final statement name will be "myapp-query1".

      If you did not configure an application name and use this method to set an explicit statement name, the statement name you provide will be used as-is (fully qualified).

      The name you set here applies only to the next statement submission; it is automatically reset afterward. Submissions without an explicit name auto-generate a unique name.

      To simply run multiple statements without managing names, configure an application name via ConfluentSettings.Builder.setApplicationName(String) once; every statement then receives a unique, namespaced {applicationName}-<generated> name. Use this method only when a specific statement needs a stable name so it can be stopped, resumed, or replaced across runs, calling it again before each such submission — auto-generated names are unique but differ on every run.

      Naming constraints:

      • Must contain only lowercase alphanumeric characters and hyphens
      • Must start and end with an alphanumeric character (not a hyphen)
      • Maximum length: 100 characters (including the application name prefix if configured)
      Parameters:
      env - the table environment
      name - the statement name (will be prefixed with application name if configured)
    • collectChangelog

      public static List<Row> collectChangelog(Table table)
      Executes the given table transformations on Confluent Cloud and returns the results locally as a list of changelog rows.

      This method performs table.execute().collect() under the hood and consumes all rows from the returned iterator.

      Note: The method assumes that all input tables are finite. If the pipeline is potentially unbounded, use collectChangelog(Table, int) for stop fetching after the desired amount of rows has been reached.

    • collectChangelog

      public static List<Row> collectChangelog(TableResult tableResult)
      Returns the given table results locally as a list of changelog rows.
      See Also:
    • collectChangelog

      public static List<Row> collectChangelog(Table table, int stopAfter)
      Executes the given table transformations on Confluent Cloud and returns the results locally as a list of changelog rows.

      This method performs table.execute().collect() under the hood and consumes a fixed amount of rows from the returned iterator.

      Note: The method can work on both finite and infinite input tables. If the pipeline is potentially unbounded, it will stop fetching after the desired amount of rows has been reached.

    • collectChangelog

      public static List<Row> collectChangelog(TableResult tableResult, int stopAfter)
      Returns the given table results locally as a list of changelog rows.
      See Also:
    • collectMaterialized

      public static List<Row> collectMaterialized(Table table)
      Executes the given table transformations on Confluent Cloud and returns the results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and returned as a list of insert-only rows.

      This method performs table.execute().collect() under the hood and consumes all rows from the returned iterator.

      Note: The method assumes that all input tables are finite. If the pipeline is potentially unbounded, use collectMaterialized(Table, int) for stop fetching after the desired amount of rows has been reached.

    • collectMaterialized

      public static List<Row> collectMaterialized(TableResult tableResult)
      Returns the given results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and returned as a list of insert-only rows.
      See Also:
    • collectMaterialized

      public static List<Row> collectMaterialized(Table table, int stopAfter)
      Executes the given table transformations on Confluent Cloud and returns the results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and returned as a list of insert-only rows.

      This method performs table.execute().collect() under the hood and consumes a fixed amount of rows from the returned iterator.

      Note: The method can work on both finite and infinite input tables. If the pipeline is potentially unbounded, it will stop fetching after the desired amount of rows has been reached.

    • collectMaterialized

      public static List<Row> collectMaterialized(TableResult tableResult, int stopAfter)
      Returns the given results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and returned as a list of insert-only rows.
      See Also:
    • printChangelog

      public static void printChangelog(Table table)
      Executes the given table transformations on Confluent Cloud and prints the results locally as a table prefixed with a change flag column.

      This method performs table.execute().collect() under the hood and consumes all rows from the returned iterator.

      Note: The method assumes that all input tables are finite. If the pipeline is potentially unbounded, use printChangelog(Table, int) for stop fetching after the desired amount of rows has been reached.

    • printChangelog

      public static void printChangelog(TableResult tableResult)
      Prints the results locally as a table prefixed with a change flag column.
      See Also:
    • printChangelog

      public static void printChangelog(Table table, int stopAfter)
      Executes the given table transformations on Confluent Cloud and prints the results locally as a table prefixed with a change flag column.

      This method performs table.execute().collect() under the hood and consumes a fixed amount of rows from the returned iterator.

      Note: The method can work on both finite and infinite input tables. If the pipeline is potentially unbounded, it will stop fetching after the desired amount of rows has been reached.

    • printChangelog

      public static void printChangelog(TableResult tableResult, int stopAfter)
      Prints the given table results locally as a table prefixed with a change flag column.
      See Also:
    • printMaterialized

      public static void printMaterialized(Table table)
      Executes the given table transformations on Confluent Cloud and prints the results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and printed.

      This method performs table.execute().collect() under the hood and consumes all rows from the returned iterator.

      Note: The method assumes that all input tables are finite. If the pipeline is potentially unbounded, use printMaterialized(Table, int) for stop fetching after the desired amount of rows has been reached.

    • printMaterialized

      public static void printMaterialized(TableResult tableResult)
      Prints the given table results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and printed.
      See Also:
    • printMaterialized

      public static void printMaterialized(Table table, int stopAfter)
      Executes the given table transformations on Confluent Cloud and prints the results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and printed.

      This method performs table.execute().collect() under the hood and consumes a fixed amount of rows from the returned iterator.

      Note: The method can work on both finite and infinite input tables. If the pipeline is potentially unbounded, it will stop fetching after the desired amount of rows has been reached.

    • printMaterialized

      public static void printMaterialized(TableResult tableResult, int stopAfter)
      Prints the given table results locally as a materialized changelog. In other words: Changes are applied to an in-memory table and printed.
      See Also:
    • getStatementName

      public static String getStatementName(TableResult tableResult)
      Returns the statement name behind the given table result.
    • stopStatement

      public static void stopStatement(TableResult tableResult)
      Stops the statement behind the given table result, blocking until the statement reaches a stopped state or the configured timeout (client.timeout) elapses.
    • stopStatement

      public static void stopStatement(TableResult tableResult, boolean await)
      Stops the statement behind the given table result, optionally waiting for the statement to reach a stopped state before returning.
    • resumeStatement

      public static void resumeStatement(TableEnvironment env, String statementName)
      Resumes the statement behind the given statement name, blocking until the statement resumes or the configured timeout (client.timeout) elapses.
    • resumeStatement

      public static void resumeStatement(TableEnvironment env, String statementName, boolean await)
      Resumes the statement behind the given statement name, optionally waiting for the statement to resume before returning.
    • stopStatement

      public static void stopStatement(TableEnvironment env, String statementName)
      Stops the statement behind the given statement name, blocking until the statement reaches a stopped state or the configured timeout (client.timeout) elapses.
    • stopStatement

      public static void stopStatement(TableEnvironment env, String statementName, boolean await)
      Stops the statement behind the given statement name, optionally waiting for the statement to reach a stopped state before returning.
    • deleteStatement

      public static void deleteStatement(TableEnvironment env, String statementName)
      Deletes the statement behind the given statement name, blocking until the deletion completes or the configured timeout (client.timeout) elapses.
    • deleteStatement

      public static void deleteStatement(TableEnvironment env, String statementName, boolean await)
      Deletes the statement behind the given statement name, optionally waiting for the deletion to complete before returning.
    • deleteArtifact

      public static void deleteArtifact(TableEnvironment env, String artifactId)
      Deletes the artifact with the given id (e.g. cfa-...) from Confluent Cloud.

      Requires artifact credentials (a global API key/secret or a dedicated Artifact API key/secret).

    • getStatementHandle

      public static StatementHandle getStatementHandle(TableEnvironment env, String statementName)
      Returns a StatementHandle to manage a submitted Flink SQL statement on Confluent Cloud.
      See Also:
    • getStatementHandle

      public static StatementHandle getStatementHandle(TableResult tableResult)
      Returns a StatementHandle to manage a submitted Flink SQL statement on Confluent Cloud.
      See Also: