Apache Flink Web Dashboard - Provides a web-based user interface for monitoring and managing Apache Flink jobs and runtime.
npx @tessl/cli install tessl/maven-org-apache-flink--flink-runtime-web-2-12@1.14.0Apache 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.
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-runtime-web_2.12</artifactId>
<version>1.14.6</version>
</dependency>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.*;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();The Flink Runtime Web component is built around several key architectural patterns:
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.
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();
}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
}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
}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
}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();
}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();
}The package provides the following REST endpoints for JAR management:
The package includes comprehensive error handling through: