Interface Client


  • public interface Client
    A client that connects to a specific ksqlDB server.
    • Method Detail

      • streamQuery

        CompletableFuture<StreamedQueryResult> streamQuery​(String sql)
        Executes a query (push or pull) and returns the results one row at a time.

        If a non-200 response is received from the server, the CompletableFuture will be failed.

        Parameters:
        sql - statement of query to execute
        Returns:
        a future that completes once the server response is received, and contains the query result if successful
      • streamQuery

        CompletableFuture<StreamedQueryResult> streamQuery​(String sql,
                                                           Map<String,​Object> properties)
        Executes a query (push or pull) and returns the results one row at a time.

        If a non-200 response is received from the server, the CompletableFuture will be failed.

        Parameters:
        sql - statement of query to execute
        properties - query properties
        Returns:
        a future that completes once the server response is received, and contains the query result if successful
      • executeQuery

        BatchedQueryResult executeQuery​(String sql)
        Executes a query (push or pull) and returns all result rows in a single batch, once the query has completed.
        Parameters:
        sql - statement of query to execute
        Returns:
        query result
      • executeQuery

        BatchedQueryResult executeQuery​(String sql,
                                        Map<String,​Object> properties)
        Executes a query (push or pull) and returns all result rows in a single batch, once the query has completed.
        Parameters:
        sql - statement of query to execute
        properties - query properties
        Returns:
        query result
      • insertInto

        CompletableFuture<Void> insertInto​(String streamName,
                                           KsqlObject row)
        Inserts a row into a ksqlDB stream.

        The CompletableFuture will be failed if a non-200 response is received from the server, or if the server encounters an error while processing the insertion.

        Parameters:
        streamName - name of the target stream
        row - the row to insert. Keys are column names and values are column values.
        Returns:
        a future that completes once the server response is received
      • terminatePushQuery

        CompletableFuture<Void> terminatePushQuery​(String queryId)
        Terminates a push query with the specified query ID.

        If a non-200 response is received from the server, the CompletableFuture will be failed.

        Parameters:
        queryId - ID of the query to terminate
        Returns:
        a future that completes once the server response is received
      • close

        void close()
        Closes the underlying HTTP client.