Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Dolphinscheduler NettyRemotingServer Setup

From Leeroopedia


Knowledge Sources
Domains Distributed_Systems, Networking
Last Updated 2026-02-10 00:00 GMT

Overview

Concrete tool for setting up a Netty-based RPC server with method dispatch using NettyRemotingServer and JdkDynamicServerHandler.

Description

NettyRemotingServer configures a Netty ServerBootstrap with Epoll (Linux) or NIO event loop groups, SSL support, and idle state handling. It provides registerMethodInvoker(ServerMethodInvoker) to map method identifiers to their implementations. JdkDynamicServerHandler extends ChannelInboundHandlerAdapter to receive Transporter messages, look up the registered invoker, execute the method, and write back the response.

Usage

The server is started by Spring during application bootstrap on both master and worker nodes. RPC service implementations are auto-discovered and registered via registerMethodInvoker().

Code Reference

Source Location

  • Repository: dolphinscheduler
  • File: dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/server/NettyRemotingServer.java (L70-147)
  • File: dolphinscheduler-extract/dolphinscheduler-extract-base/src/main/java/org/apache/dolphinscheduler/extract/base/server/JdkDynamicServerHandler.java (L48-169)

Signature

public class NettyRemotingServer implements AutoCloseable {
    public NettyRemotingServer(NettyServerConfig serverConfig);
    public void start();
    public void registerMethodInvoker(ServerMethodInvoker serverMethodInvoker);
    @Override public void close();
}

public class JdkDynamicServerHandler extends ChannelInboundHandlerAdapter {
    private final Map<String, ServerMethodInvoker> methodInvokerMap;

    public void registerMethodInvoker(ServerMethodInvoker serverMethodInvoker);
    @Override public void channelRead(ChannelHandlerContext ctx, Object msg);
    public void processReceived(Channel channel, Transporter transporter);
    @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause);
}

Import

import org.apache.dolphinscheduler.extract.base.server.NettyRemotingServer;
import org.apache.dolphinscheduler.extract.base.config.NettyServerConfig;

I/O Contract

Inputs

Name Type Required Description
serverConfig NettyServerConfig Yes Server bind port, boss/worker thread counts
serverMethodInvoker ServerMethodInvoker Yes Method invoker wrapping a service implementation method
Transporter Wire message Yes Incoming serialized RPC request

Outputs

Name Type Description
Listening server Netty Channel Server bound to configured port
StandardRpcResponse Wire message Serialized response written back to client channel

Usage Examples

Server Startup

NettyServerConfig config = new NettyServerConfig();
config.setListenPort(5678);

NettyRemotingServer server = new NettyRemotingServer(config);
server.registerMethodInvoker(workflowControlInvoker);
server.registerMethodInvoker(taskEventInvoker);
server.start();

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment