Apache Flink Web Dashboard - Provides a web-based user interface for monitoring and managing Apache Flink jobs and runtime.
—
Complete JAR file lifecycle management including upload, listing, execution, and deletion. This is the core functionality for submitting and managing Flink jobs through the web interface, providing REST endpoints for all JAR operations.
Handles multipart file uploads for JAR files via POST /jars/upload endpoint.
/**
* Handler for uploading JAR files to the Flink web server.
* Supports multipart/form-data uploads and stores JARs in the configured directory.
*/
public class JarUploadHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> {
/**
* Create a new JAR upload handler.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for upload operations
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param jarDir Directory where uploaded JARs will be stored
* @param executor Executor for handling upload operations
*/
public JarUploadHandler(
GatewayRetriever<? extends RestfulGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> messageHeaders,
Path jarDir,
Executor executor
);
}Provides listing of all uploaded JAR files with entry point information via GET /jars endpoint.
/**
* Handler for listing uploaded JAR files and their available entry points.
* Returns detailed information about each JAR including main classes and program arguments.
*/
public class JarListHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarListInfo, EmptyMessageParameters> {
/**
* Create a new JAR list handler.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for listing operations
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param localAddressFuture Future containing the local server address
* @param jarDir Directory containing uploaded JARs
* @param configuration Flink configuration
* @param executor Executor for JAR analysis operations
*/
public JarListHandler(
GatewayRetriever<? extends RestfulGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<EmptyRequestBody, JarListInfo, EmptyMessageParameters> messageHeaders,
CompletableFuture<String> localAddressFuture,
File jarDir,
Configuration configuration,
Executor executor
);
}Executes uploaded JAR files as Flink jobs via POST /jars/:jarId/run endpoint.
/**
* Handler for executing uploaded JAR files as Flink jobs.
* Supports job configuration including parallelism, savepoints, and program arguments.
*/
public class JarRunHandler extends AbstractRestHandler<DispatcherGateway, JarRunRequestBody, JarRunResponseBody, JarRunMessageParameters> {
/**
* Create a new JAR run handler.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for job submission
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param jarDir Directory containing uploaded JARs
* @param configuration Flink configuration
* @param executor Executor for job submission operations
* @param applicationRunnerSupplier Supplier for creating application runners
*/
public JarRunHandler(
GatewayRetriever<? extends DispatcherGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<JarRunRequestBody, JarRunResponseBody, JarRunMessageParameters> messageHeaders,
Path jarDir,
Configuration configuration,
Executor executor,
Supplier<ApplicationRunner> applicationRunnerSupplier
);
}Deletes uploaded JAR files via DELETE /jars/:jarId endpoint.
/**
* Handler for deleting uploaded JAR files from the server.
* Removes both the JAR file and any associated metadata.
*/
public class JarDeleteHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, EmptyResponseBody, JarDeleteMessageParameters> {
/**
* Create a new JAR delete handler.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for delete operations
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param jarDir Directory containing uploaded JARs
* @param executor Executor for delete operations
*/
public JarDeleteHandler(
GatewayRetriever<? extends RestfulGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<EmptyRequestBody, EmptyResponseBody, JarDeleteMessageParameters> messageHeaders,
Path jarDir,
Executor executor
);
}Shows execution plan for JAR files without running them via GET and POST /jars/:jarId/plan endpoints.
/**
* Handler for generating execution plans from uploaded JAR files.
* Shows the job graph that would be executed without actually running the job.
*/
public class JarPlanHandler extends AbstractRestHandler<RestfulGateway, JarPlanRequestBody, JobPlanInfo, JarPlanMessageParameters> {
/**
* Create a new JAR plan handler with default plan generator.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for plan generation
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param jarDir Directory containing uploaded JARs
* @param configuration Flink configuration
* @param executor Executor for plan generation operations
*/
public JarPlanHandler(
GatewayRetriever<? extends RestfulGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<JarPlanRequestBody, JobPlanInfo, JarPlanMessageParameters> messageHeaders,
Path jarDir,
Configuration configuration,
Executor executor
);
/**
* Create a new JAR plan handler with custom plan generator.
*
* @param leaderRetriever Gateway retriever for accessing Flink cluster
* @param timeout Request timeout for plan generation
* @param responseHeaders HTTP headers to include in responses
* @param messageHeaders Message header specification for this endpoint
* @param jarDir Directory containing uploaded JARs
* @param configuration Flink configuration
* @param executor Executor for plan generation operations
* @param planGenerator Custom function to generate JobPlanInfo from JobGraph
*/
public JarPlanHandler(
GatewayRetriever<? extends RestfulGateway> leaderRetriever,
Time timeout,
Map<String, String> responseHeaders,
MessageHeaders<JarPlanRequestBody, JobPlanInfo, JarPlanMessageParameters> messageHeaders,
Path jarDir,
Configuration configuration,
Executor executor,
Function<JobGraph, JobPlanInfo> planGenerator
);
}import org.apache.flink.runtime.webmonitor.handlers.*;
import org.apache.flink.configuration.Configuration;
import java.nio.file.Paths;
// Setup configuration
Configuration config = new Configuration();
Path jarDir = Paths.get("/tmp/flink-jars");
Time timeout = Time.seconds(30);
Map<String, String> headers = Collections.emptyMap();
// Create handlers
JarUploadHandler uploadHandler = new JarUploadHandler(
leaderRetriever,
timeout,
headers,
JarUploadHeaders.getInstance(),
jarDir,
executor
);
JarListHandler listHandler = new JarListHandler(
leaderRetriever,
timeout,
headers,
JarListHeaders.getInstance(),
jarDir,
config,
executor
);
JarRunHandler runHandler = new JarRunHandler(
leaderRetriever,
timeout,
headers,
JarRunHeaders.getInstance(),
jarDir,
config,
executor,
applicationRunnerSupplier
);// Upload a JAR (would typically be handled by HTTP multipart upload)
// The actual upload is handled by the JarUploadHandler via HTTP POST
// List uploaded JARs
HandlerRequest<EmptyRequestBody, EmptyMessageParameters> listRequest =
HandlerRequest.create(EmptyRequestBody.getInstance(), EmptyMessageParameters.getInstance());
CompletableFuture<JarListInfo> jarList = listHandler.handleRequest(listRequest, restfulGateway);
// Run a JAR
JarRunRequestBody runRequest = new JarRunRequestBody();
runRequest.setEntryClassName("com.example.MyFlinkJob");
runRequest.setProgramArguments(Arrays.asList("--input", "/path/to/input"));
runRequest.setParallelism(4);
HandlerRequest<JarRunRequestBody, JarRunMessageParameters> runHandlerRequest =
HandlerRequest.create(runRequest, jarRunMessageParameters, pathParameters, queryParameters);
CompletableFuture<JarRunResponseBody> jobResult = runHandler.handleRequest(runHandlerRequest, restfulGateway);All JAR handlers include comprehensive error handling for common scenarios:
// Typical error handling pattern in handler usage
jarRunHandler.handleRequest(request, gateway)
.whenComplete((result, throwable) -> {
if (throwable != null) {
if (throwable instanceof NotFoundException) {
// Handle JAR not found
} else if (throwable instanceof BadRequestException) {
// Handle invalid request parameters
} else {
// Handle other errors
}
} else {
// Process successful result
JobID jobId = result.getJobId();
}
});The JAR management handlers correspond to the following REST endpoints:
All endpoints support proper HTTP status codes, error responses, and JSON request/response bodies where applicable.
Install with Tessl CLI
npx tessl i tessl/maven-org-apache-flink--flink-runtime-web-2-12