Netty 3 based transport implementation for Elasticsearch providing TCP and HTTP transport layers
npx @tessl/cli install tessl/maven-org-elasticsearch-plugin--transport-netty3-client@5.6.0A comprehensive Elasticsearch plugin that provides Netty 3-based transport layer implementation for both TCP and HTTP communications within Elasticsearch clusters. This plugin serves as an alternative to the default Netty 4-based transport, enabling compatibility with systems that specifically require Netty 3 networking framework.
import org.elasticsearch.transport.Netty3Plugin;
import org.elasticsearch.transport.netty3.Netty3Transport;
import org.elasticsearch.http.netty3.Netty3HttpServerTransport;// Plugin registration (handled automatically by Elasticsearch)
// The plugin provides "netty3" transport implementations
// Configuration in elasticsearch.yml
// transport.type: netty3
// http.type: netty3
// Programmatic access to transport instances
Settings settings = Settings.builder()
.put("transport.type", "netty3")
.put("http.type", "netty3")
.build();
// Plugin provides transport factories through NetworkPlugin interface
Netty3Plugin plugin = new Netty3Plugin();
List<Setting<?>> pluginSettings = plugin.getSettings();The transport-netty3 plugin is built around several key components:
Netty3Plugin class implementing Elasticsearch's NetworkPlugin interfaceNetty3Transport providing internal cluster communication via Netty 3Netty3HttpServerTransport handling REST API requests via Netty 3Main plugin entry point providing transport factories for Elasticsearch's networking layer. This capability registers the plugin with Elasticsearch and exposes available configuration settings.
public class Netty3Plugin extends Plugin implements NetworkPlugin {
public static final String NETTY_TRANSPORT_NAME = "netty3";
public static final String NETTY_HTTP_TRANSPORT_NAME = "netty3";
public List<Setting<?>> getSettings();
public Map<String, Supplier<Transport>> getTransports(
Settings settings, ThreadPool threadPool, BigArrays bigArrays,
CircuitBreakerService circuitBreakerService,
NamedWriteableRegistry namedWriteableRegistry,
NetworkService networkService
);
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
Settings settings, ThreadPool threadPool, BigArrays bigArrays,
CircuitBreakerService circuitBreakerService,
NamedWriteableRegistry namedWriteableRegistry,
NamedXContentRegistry xContentRegistry,
NetworkService networkService,
HttpServerTransport.Dispatcher dispatcher
);
}Core TCP transport implementation for internal Elasticsearch cluster communication. Provides connection management, message handling, and network optimization for node-to-node communication.
public class Netty3Transport extends TcpTransport<Channel> {
public static final Setting<Integer> WORKER_COUNT;
public static final Setting<ByteSizeValue> NETTY_MAX_CUMULATION_BUFFER_CAPACITY;
public static final Setting<Integer> NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;
public Netty3Transport(Settings settings, ThreadPool threadPool,
NetworkService networkService, BigArrays bigArrays,
NamedWriteableRegistry namedWriteableRegistry,
CircuitBreakerService circuitBreakerService);
public long serverOpen();
public ChannelPipelineFactory configureClientChannelPipelineFactory();
public ChannelPipelineFactory configureServerChannelPipelineFactory(String name, Settings settings);
}Complete HTTP server implementation for Elasticsearch's REST API. Handles HTTP requests, response processing, request pipelining, and CORS support for web-based clients.
public class Netty3HttpServerTransport extends AbstractLifecycleComponent
implements HttpServerTransport {
public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY;
public static final Setting<Integer> SETTING_HTTP_WORKER_COUNT;
public static final Setting<Boolean> SETTING_HTTP_TCP_NO_DELAY;
public Netty3HttpServerTransport(Settings settings, NetworkService networkService,
BigArrays bigArrays, ThreadPool threadPool,
NamedXContentRegistry xContentRegistry,
HttpServerTransport.Dispatcher dispatcher);
public Settings settings();
public BoundTransportAddress boundAddress();
public HttpInfo info();
public HttpStats stats();
public Netty3CorsConfig getCorsConfig();
}Utility functions for buffer management, channel handling, and Netty 3 integration. Provides conversion between Elasticsearch's BytesReference and Netty's ChannelBuffer types.
public class Netty3Utils {
public static final boolean DEFAULT_GATHERING = true;
public static void setup();
public static ChannelBuffer toChannelBuffer(BytesReference bytes);
public static BytesReference toBytesReference(ChannelBuffer buffer);
public static BytesReference toBytesReference(ChannelBuffer buffer, int size);
public static void closeChannels(Collection<Channel> channels);
public static void maybeDie(Throwable t);
}Cross-Origin Resource Sharing support for web-based Elasticsearch clients. Provides comprehensive CORS policy configuration including origins, methods, headers, and credential handling.
public class Netty3CorsConfig {
public boolean isCorsSupportEnabled();
public boolean isAnyOriginSupported();
public Set<String> origins();
public boolean isOriginAllowed(String origin);
public boolean isCredentialsAllowed();
public long maxAge();
public Set<HttpMethod> allowedRequestMethods();
public Set<String> allowedRequestHeaders();
}
public class Netty3CorsConfigBuilder {
public static Netty3CorsConfigBuilder forAnyOrigin();
public static Netty3CorsConfigBuilder forOrigin(String origin);
public Netty3CorsConfigBuilder allowCredentials();
public Netty3CorsConfigBuilder maxAge(long maxAge);
public Netty3CorsConfig build();
}HTTP request/response processing, pipelining support, and channel lifecycle management for REST API communication.
public final class Netty3HttpChannel extends AbstractRestChannel {
public Netty3HttpChannel(Netty3HttpServerTransport transport, Netty3HttpRequest request,
OrderedUpstreamMessageEvent orderedUpstreamMessageEvent,
boolean detailedErrorsEnabled, ThreadContext threadContext);
public BytesStreamOutput newBytesOutput();
public void sendResponse(RestResponse response);
}
public class Netty3HttpRequest extends RestRequest {
public Netty3HttpRequest(NamedXContentRegistry xContentRegistry, HttpRequest request, Channel channel);
public HttpRequest request();
public Method method();
public String uri();
public boolean hasContent();
public BytesReference content();
public SocketAddress getRemoteAddress();
public SocketAddress getLocalAddress();
public Channel getChannel();
}
public class HttpPipeliningHandler extends SimpleChannelHandler {
public static final int INITIAL_EVENTS_HELD = 3;
public HttpPipeliningHandler(int maxEventsHeld);
public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e);
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e);
}The plugin exposes numerous configuration settings for fine-tuning network performance:
transport.netty.worker_count - Number of worker threads (default: 2 * processors)transport.netty.max_cumulation_buffer_capacity - Maximum cumulation buffer capacitytransport.netty.max_composite_buffer_components - Maximum composite buffer componentstransport.netty.receive_predictor_size - Receive buffer size predictortransport.netty.boss_count - Number of boss threads (default: 1)http.netty.worker_count - HTTP worker thread counthttp.tcp.no_delay - TCP no delay settinghttp.tcp.keep_alive - TCP keep alive settinghttp.tcp.send_buffer_size - TCP send buffer sizehttp.tcp.receive_buffer_size - TCP receive buffer sizeNote: This plugin is deprecated in favor of the newer Netty 4 implementation. It maintains backward compatibility for systems requiring Netty 3 specifically.