CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-flink--flink-queryable-state-client-java

Java client library for accessing queryable state in Apache Flink streaming applications through a network-based query interface.

Pending
Overview
Eval results
Files

client-management.mddocs/

Client Management

Core client functionality for connecting to Flink clusters, managing configuration, and handling client lifecycle operations.

Capabilities

Client Creation

Create a QueryableStateClient to connect to a Flink cluster's client proxy.

public QueryableStateClient(String remoteHostname, int remotePort) throws UnknownHostException;
public QueryableStateClient(InetAddress remoteAddress, int remotePort);

Parameters:

  • remoteHostname - Hostname of the client proxy to connect to (throws UnknownHostException if invalid)
  • remotePort - Port of the client proxy (must be in range 0-65535)
  • remoteAddress - InetAddress of the client proxy to connect to

Usage Example:

// Connect using hostname
QueryableStateClient client = new QueryableStateClient("localhost", 9069);

// Connect using InetAddress
InetAddress address = InetAddress.getByName("192.168.1.100");
QueryableStateClient client = new QueryableStateClient(address, 9069);

Configuration Management

Configure execution settings and classloader for serialization.

public ExecutionConfig getExecutionConfig();
public ExecutionConfig setExecutionConfig(ExecutionConfig config);
public ClassLoader setUserClassLoader(ClassLoader userClassLoader);

Returns:

  • getExecutionConfig() - Current ExecutionConfig or null if not set
  • setExecutionConfig() - Previous ExecutionConfig or null if none was set
  • setUserClassLoader() - Previous ClassLoader or null if none was set

Usage Example:

QueryableStateClient client = new QueryableStateClient("localhost", 9069);

// Configure execution config
ExecutionConfig config = new ExecutionConfig();
config.enableObjectReuse(); // Example configuration
ExecutionConfig previous = client.setExecutionConfig(config);

// Set custom classloader for serialization
ClassLoader customClassLoader = Thread.currentThread().getContextClassLoader();
client.setUserClassLoader(customClassLoader);

Lifecycle Management

Manage the client lifecycle with proper shutdown procedures.

public CompletableFuture<?> shutdownAndHandle();
public void shutdownAndWait();

Returns:

  • shutdownAndHandle() - CompletableFuture that completes when shutdown is finished
  • shutdownAndWait() - void (blocks until shutdown completes)

Behavior:

  • shutdownAndHandle() - Returns a future for asynchronous shutdown handling
  • shutdownAndWait() - Blocks the calling thread until shutdown completes; logs warnings on exceptions

Usage Example:

QueryableStateClient client = new QueryableStateClient("localhost", 9069);

// Perform queries...

// Asynchronous shutdown
client.shutdownAndHandle().thenRun(() -> {
    System.out.println("Client shutdown completed");
}).exceptionally(throwable -> {
    System.err.println("Shutdown failed: " + throwable.getMessage());
    return null;
});

// Or synchronous shutdown
client.shutdownAndWait();

Internal Components

The client internally manages:

  • Network Client: Netty-based client for communication with the cluster
  • Message Serialization: Handles KvStateRequest/KvStateResponse serialization
  • Statistics: Optional request statistics tracking (disabled by default)
  • Remote Address: Cached connection information for the client proxy

The client proxy serves as the entry point to the Flink cluster, forwarding requests to the JobManager for location resolution and to TaskManagers for actual state queries.

Install with Tessl CLI

npx tessl i tessl/maven-org-apache-flink--flink-queryable-state-client-java

docs

client-management.md

exception-handling.md

immutable-state.md

index.md

state-querying.md

tile.json