CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-apache-flink--flink-runtime-web-2-12

Apache Flink Web Dashboard - Provides a web-based user interface for monitoring and managing Apache Flink jobs and runtime.

Pending
Overview
Eval results
Files

jar-management.mddocs/

JAR Management

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.

Capabilities

JAR Upload Handler

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
    );
}

JAR List Handler

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
    );
}

JAR Run Handler

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
    );
}

JAR Delete Handler

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
    );
}

JAR Plan Handler

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
    );
}

Usage Examples

Complete JAR Management Workflow

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
);

Programmatic JAR Operations

// 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);

Error Handling in JAR Operations

All JAR handlers include comprehensive error handling for common scenarios:

  • File not found: When specified JAR ID doesn't exist
  • Invalid JAR files: When uploaded files are not valid JAR files
  • Class loading errors: When entry classes cannot be loaded
  • Job submission failures: When jobs fail to submit to the cluster
  • Timeout handling: When operations exceed specified timeout limits
// 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();
        }
    });

REST Endpoint Specifications

The JAR management handlers correspond to the following REST endpoints:

  • POST /jars/upload - Upload JAR files (multipart/form-data)
  • GET /jars - List uploaded JARs with entry point information
  • POST /jars/{jarId}/run - Execute JAR as Flink job
  • DELETE /jars/{jarId} - Delete uploaded JAR
  • GET /jars/{jarId}/plan - Show execution plan without running
  • POST /jars/{jarId}/plan - Show execution plan with custom parameters

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

docs

data-transfer-objects.md

history-server.md

index.md

jar-management.md

rest-api-specifications.md

utilities-extensions.md

web-server-bootstrap.md

tile.json