or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

data-transfer-objects.mdhistory-server.mdindex.mdjar-management.mdrest-api-specifications.mdutilities-extensions.mdweb-server-bootstrap.md
tile.json

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.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.apache.flink/flink-runtime-web_2.12@1.14.x

To install, run

npx @tessl/cli install tessl/maven-org-apache-flink--flink-runtime-web-2-12@1.14.0

index.mddocs/

Apache Flink Runtime Web

Apache Flink Runtime Web is a Java library that provides comprehensive web-based interfaces for Apache Flink runtime operations. It enables JAR file management, job execution through REST APIs, and includes a standalone history server for viewing completed jobs. Built on Netty with a modern Angular frontend, it serves as the essential web dashboard component for monitoring and managing Apache Flink streaming applications.

Package Information

  • Package Name: flink-runtime-web_2.12
  • Package Type: Maven
  • Language: Java
  • License: Apache-2.0
  • Installation: Add to Maven pom.xml:
    <dependency>
      <groupId>org.apache.flink</groupId>
      <artifactId>flink-runtime-web_2.12</artifactId>
      <version>1.14.6</version>
    </dependency>

Core Imports

import org.apache.flink.runtime.webmonitor.utils.WebFrontendBootstrap;
import org.apache.flink.runtime.webmonitor.history.HistoryServer;
import org.apache.flink.runtime.webmonitor.WebSubmissionExtension;
import org.apache.flink.runtime.rest.handler.router.Router;
import org.apache.flink.configuration.Configuration;
import org.slf4j.Logger;
import java.io.File;

For JAR management handlers:

import org.apache.flink.runtime.webmonitor.handlers.*;

Basic Usage

import org.apache.flink.runtime.webmonitor.utils.WebFrontendBootstrap;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.shaded.netty4.io.netty.handler.ssl.util.SelfSignedCertificate;
import java.io.File;

// Create web frontend bootstrap
Configuration config = new Configuration();
File uploadDir = new File("/tmp/flink-web-upload");
WebFrontendBootstrap bootstrap = new WebFrontendBootstrap(
    router,
    logger,
    uploadDir,
    null, // SSL handler factory
    "localhost",
    8081,
    config
);

// Get server details
int port = bootstrap.getServerPort();
String address = bootstrap.getRestAddress();

// Shutdown when done
bootstrap.shutdown();

For standalone history server:

import org.apache.flink.runtime.webmonitor.history.HistoryServer;
import org.apache.flink.configuration.Configuration;

// Start history server
Configuration config = new Configuration();
HistoryServer historyServer = new HistoryServer(config);
historyServer.run();

Architecture

The Flink Runtime Web component is built around several key architectural patterns:

  • Netty-based Server: High-performance HTTP server using Netty with custom routing
  • REST API Handlers: Modular request handlers extending AbstractRestHandler for specific operations
  • Data Transfer Objects: Type-safe request/response bodies for API communication
  • Parameter System: Type-safe query and path parameter definitions
  • Extension Pattern: WebSubmissionExtension provides modular JAR submission capabilities
  • History Server: Standalone server for archived job information and static file serving

This design enables both embedded use (via WebFrontendBootstrap) and standalone deployment (via HistoryServer), with a clean separation between server infrastructure, REST API handlers, and data models.

Capabilities

Web Server Bootstrap

Core infrastructure for setting up and managing the Netty-based web server. Provides the foundation for embedding Flink's web interface in applications.

public class WebFrontendBootstrap {
    public WebFrontendBootstrap(
        Router router,
        Logger logger,
        File uploadDir,
        SSLHandlerFactory sslHandlerFactory,
        String address,
        int port,
        Configuration configuration
    );
    
    public ServerBootstrap getBootstrap();
    public int getServerPort();
    public String getRestAddress();
    public void shutdown();
}

Web Server Bootstrap

JAR Management

Complete JAR file lifecycle management including upload, listing, execution, and deletion. Core functionality for submitting and managing Flink jobs through the web interface.

public class JarUploadHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> {
    public JarUploadHandler(
        GatewayRetriever<? extends RestfulGateway> leaderRetriever,
        Time timeout,
        Map<String, String> responseHeaders,
        MessageHeaders<EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> messageHeaders,
        Path jarDir,
        Executor executor
    );
}

public class JarRunHandler extends AbstractRestHandler<RestfulGateway, JarRunRequestBody, JarRunResponseBody, JarRunMessageParameters> {
    // POST /jars/:jarId/run
}

public class JarListHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarListInfo, EmptyMessageParameters> {
    // GET /jars
}

JAR Management

History Server

Standalone server functionality for viewing archived job information and serving static files. Ideal for long-term job monitoring and analysis.

public class HistoryServer {
    public HistoryServer(Configuration configuration);
    public HistoryServer(Configuration configuration, Consumer<ArchiveEvent> eventListener);
    
    public static void main(String[] args);
    public void run();
}

public class HistoryServerArchiveFetcher {
    // Archive management functionality
}

History Server

REST API Specifications

Type-safe REST API definitions including headers, parameters, and message specifications. Provides compile-time safety for API contracts.

public class JarUploadHeaders implements MessageHeaders<EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> {
    // POST /jars/upload specification
}

public class JarRunHeaders implements MessageHeaders<JarRunRequestBody, JarRunResponseBody, JarRunMessageParameters> {
    // POST /jars/:jarId/run specification
}

public class JarIdPathParameter extends MessagePathParameter<String> {
    // Path parameter for JAR ID
}

REST API Specifications

Data Transfer Objects

Comprehensive request and response body classes for all API operations. Provides type-safe data exchange between client and server.

public abstract class JarRequestBody implements RequestBody {
    public String getEntryClassName();
    public List<String> getProgramArguments();
    public Integer getParallelism();
    public JobID getJobId();
}

public class JarRunRequestBody extends JarRequestBody {
    public Boolean getAllowNonRestoredState();
    public String getSavepointPath();
}

public class JarUploadResponseBody implements ResponseBody {
    public JarUploadResponseBody(String filename);
    public String getStatus();
    public String getFilename();
}

Data Transfer Objects

Utilities and Extensions

Helper utilities and extension points for JAR processing and web submission functionality. Provides reusable components for custom implementations.

public class JarHandlerUtils {
    public static List<String> tokenizeArguments(String args);
    
    public static class JarHandlerContext {
        public static JarHandlerContext fromRequest(HandlerRequest<JarRequestBody, ?> request, Path jarDir);
        public void applyToConfiguration(Configuration configuration);
        public JobGraph toJobGraph(ClassLoader classLoader);
        public PackagedProgram toPackagedProgram(ClassLoader classLoader);
    }
}

public class WebSubmissionExtension implements WebMonitorExtension {
    public Collection<Tuple2<RestHandlerSpecification, ChannelInboundHandler>> getHandlers();
    public CompletableFuture<Void> closeAsync();
}

Utilities and Extensions

REST Endpoints Summary

The package provides the following REST endpoints for JAR management:

  • POST /jars/upload - Upload JAR files to the server
  • GET /jars - List all uploaded JAR files with entry point information
  • POST /jars/:jarId/run - Execute an uploaded JAR as a Flink job
  • DELETE /jars/:jarId - Delete an uploaded JAR file
  • GET /jars/:jarId/plan - Show execution plan for JAR without running
  • POST /jars/:jarId/plan - Show execution plan with custom parameters

Error Handling

The package includes comprehensive error handling through:

  • PipelineErrorHandler: Final error handler in the Netty pipeline
  • Validation: Parameter validation in all request handlers
  • HTTP Status Codes: Proper REST API status code responses
  • Exception Translation: Conversion of internal exceptions to HTTP responses