Web-based monitoring and management interface for Apache Flink with REST APIs and Angular dashboard.
npx @tessl/cli install tessl/maven-org-apache-flink--flink-runtime-web@2.1.0Apache Flink Runtime Web provides a comprehensive web-based monitoring and management interface for Apache Flink stream processing applications. It combines a Java backend built with Netty for REST API services and an Angular frontend dashboard for real-time visualization and interaction.
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime-web</artifactId>
<version>2.1.0</version>
</dependency>// Main components
import org.apache.flink.runtime.webmonitor.WebSubmissionExtension;
import org.apache.flink.runtime.webmonitor.history.HistoryServer;
import org.apache.flink.runtime.webmonitor.utils.WebFrontendBootstrap;
// JAR management handlers
import org.apache.flink.runtime.webmonitor.handlers.JarUploadHandler;
import org.apache.flink.runtime.webmonitor.handlers.JarListHandler;
import org.apache.flink.runtime.webmonitor.handlers.JarRunHandler;
import org.apache.flink.runtime.webmonitor.handlers.JarPlanHandler;
import org.apache.flink.runtime.webmonitor.handlers.JarDeleteHandler;
// Message headers
import org.apache.flink.runtime.webmonitor.handlers.JarUploadHeaders;
import org.apache.flink.runtime.webmonitor.handlers.JarListHeaders;
import org.apache.flink.runtime.webmonitor.handlers.JarRunHeaders;
import org.apache.flink.runtime.webmonitor.handlers.JarPlanGetHeaders;
import org.apache.flink.runtime.webmonitor.handlers.JarPlanPostHeaders;
import org.apache.flink.runtime.webmonitor.handlers.JarDeleteHeaders;
// Request/Response models
import org.apache.flink.runtime.webmonitor.handlers.JarRequestBody;
import org.apache.flink.runtime.webmonitor.handlers.JarRunRequestBody;
import org.apache.flink.runtime.webmonitor.handlers.JarPlanRequestBody;
import org.apache.flink.runtime.webmonitor.handlers.JarUploadResponseBody;
import org.apache.flink.runtime.webmonitor.handlers.JarRunResponseBody;
import org.apache.flink.runtime.webmonitor.handlers.JarListInfo;
// Message parameters
import org.apache.flink.runtime.webmonitor.handlers.JarMessageParameters;
import org.apache.flink.runtime.webmonitor.handlers.JarRunMessageParameters;
import org.apache.flink.runtime.webmonitor.handlers.JarPlanMessageParameters;
import org.apache.flink.runtime.webmonitor.handlers.JarDeleteMessageParameters;
// Parameter classes
import org.apache.flink.runtime.webmonitor.handlers.JarIdPathParameter;
import org.apache.flink.runtime.webmonitor.handlers.EntryClassQueryParameter;
import org.apache.flink.runtime.webmonitor.handlers.ParallelismQueryParameter;
import org.apache.flink.runtime.webmonitor.handlers.ProgramArgQueryParameter;
import org.apache.flink.runtime.webmonitor.handlers.SavepointPathQueryParameter;
import org.apache.flink.runtime.webmonitor.handlers.AllowNonRestoredStateQueryParameter;
// Utilities
import org.apache.flink.runtime.webmonitor.handlers.utils.JarHandlerUtils;
// Core infrastructure
import org.apache.flink.runtime.webmonitor.HttpRequestHandler;
import org.apache.flink.runtime.webmonitor.PipelineErrorHandler;// Start a history server for completed jobs
Configuration config = new Configuration();
config.setString(HistoryServerOptions.HISTORY_SERVER_WEB_PORT, "8082");
config.setString(HistoryServerOptions.HISTORY_SERVER_ARCHIVE_DIRS, "/path/to/archives");
HistoryServer historyServer = new HistoryServer(config);
historyServer.start();
// Get server port
int port = historyServer.getWebPort();
System.out.println("History server running on port: " + port);The Runtime Web module is built around several key components:
Complete JAR lifecycle management including upload, execution, planning, and deletion. Supports job submission with savepoint restoration and parallelism configuration.
// JAR Upload Handler
public class JarUploadHandler extends AbstractRestHandler<RestfulGateway, EmptyRequestBody, JarUploadResponseBody, EmptyMessageParameters> {
public CompletableFuture<JarUploadResponseBody> handleRequest(
HandlerRequest<EmptyRequestBody> request,
RestfulGateway gateway
) throws RestHandlerException;
}
// JAR Run Handler
public class JarRunHandler extends AbstractRestHandler<DispatcherGateway, JarRunRequestBody, JarRunResponseBody, JarRunMessageParameters> {
public CompletableFuture<JarRunResponseBody> handleRequest(
HandlerRequest<JarRunRequestBody> request,
DispatcherGateway gateway
) throws RestHandlerException;
}Standalone server providing web interface and REST API for completed job analysis with archive management and static file serving.
public class HistoryServer {
public HistoryServer(Configuration config);
public void start() throws Exception;
public void stop() throws Exception;
public int getWebPort();
public static void main(String[] args) throws Exception;
}Core HTTP request handling, server bootstrap, and pipeline management using Netty framework.
public class WebFrontendBootstrap {
public WebFrontendBootstrap(
Router router,
Logger log,
File tmpDir,
SSLHandlerFactory sslHandlerFactory,
String configuredAddress,
int configuredPort,
Configuration configuration
) throws IOException, InterruptedException;
public int getServerPort();
public String getRestAddress();
public void shutdown();
}Comprehensive request and response models for all REST API operations with proper validation and serialization.
// JAR Upload Response
public class JarUploadResponseBody implements ResponseBody {
public JarUploadResponseBody(String filename);
public String getFilename();
public UploadStatus getStatus();
}
// JAR List Information
public class JarListInfo implements ResponseBody {
public JarListInfo(String address, List<JarFileInfo> jarFileList);
public String getAddress();
public List<JarFileInfo> getFiles();
public static class JarFileInfo {
public String getId();
public String getName();
public long getUploaded();
public List<JarEntryInfo> getEntry();
}
}Modern TypeScript dashboard providing real-time monitoring, job visualization, resource management, and developer tools.
Frontend capabilities include:
| Method | Endpoint | Purpose | Handler Class |
|---|---|---|---|
| POST | /jars/upload | Upload JAR files | JarUploadHandler |
| GET | /jars | List uploaded JARs | JarListHandler |
| POST | /jars/:jarid/run | Execute JAR file | JarRunHandler |
| GET | /jars/:jarid/plan | Get execution plan (query params) | JarPlanHandler |
| POST | /jars/:jarid/plan | Get execution plan (request body) | JarPlanHandler |
| DELETE | /jars/:jarid | Delete JAR file | JarDeleteHandler |
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /config | Server configuration |
| GET | /joboverview | Job overview for history |
| GET | /jobs/:jobid/* | Historical job details |
The module integrates with Flink's configuration system:
// History Server Options
public class HistoryServerOptions {
public static final ConfigOption<String> HISTORY_SERVER_WEB_PORT;
public static final ConfigOption<String> HISTORY_SERVER_ARCHIVE_DIRS;
public static final ConfigOption<Duration> HISTORY_SERVER_ARCHIVE_REFRESH_INTERVAL;
}The module provides comprehensive error handling through:
PipelineErrorHandler for HTTP pipeline errors