or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cors-configuration.mdhttp-channel-pipeline.mdhttp-transport.mdindex.mdnetwork-utilities.mdplugin-registration.mdtcp-transport.md
tile.json

tessl/maven-org-elasticsearch-plugin--transport-netty3-client

Netty 3 based transport implementation for Elasticsearch providing TCP and HTTP transport layers

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.elasticsearch.plugin/transport-netty3-client@5.6.x

To install, run

npx @tessl/cli install tessl/maven-org-elasticsearch-plugin--transport-netty3-client@5.6.0

index.mddocs/

Elasticsearch Transport-Netty3 Plugin

A 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.

Package Information

  • Package Name: org.elasticsearch.plugin:transport-netty3-client
  • Package Type: maven
  • Language: Java
  • Version: 5.6.16
  • License: Apache License 2.0
  • Installation: Add as Elasticsearch plugin dependency in your build configuration

Core Imports

import org.elasticsearch.transport.Netty3Plugin;
import org.elasticsearch.transport.netty3.Netty3Transport;
import org.elasticsearch.http.netty3.Netty3HttpServerTransport;

Basic Usage

// 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();

Architecture

The transport-netty3 plugin is built around several key components:

  • Plugin Entry Point: Netty3Plugin class implementing Elasticsearch's NetworkPlugin interface
  • TCP Transport Layer: Netty3Transport providing internal cluster communication via Netty 3
  • HTTP Transport Layer: Netty3HttpServerTransport handling REST API requests via Netty 3
  • Configuration System: Extensive settings for tuning network performance, buffer management, and CORS
  • Utility Framework: Buffer conversion, channel management, and error handling utilities
  • CORS Support: Complete cross-origin resource sharing configuration for web clients

Capabilities

Plugin Registration

Main 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
    );
}

Plugin Registration

TCP Transport

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);
}

TCP Transport

HTTP Transport

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();
}

HTTP Transport

Network Utilities

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);
}

Network Utilities

CORS Configuration

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();
}

CORS Configuration

HTTP Channel and Pipeline

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);
}

HTTP Channel and Pipeline

Configuration Settings

The plugin exposes numerous configuration settings for fine-tuning network performance:

TCP Transport Settings

  • transport.netty.worker_count - Number of worker threads (default: 2 * processors)
  • transport.netty.max_cumulation_buffer_capacity - Maximum cumulation buffer capacity
  • transport.netty.max_composite_buffer_components - Maximum composite buffer components
  • transport.netty.receive_predictor_size - Receive buffer size predictor
  • transport.netty.boss_count - Number of boss threads (default: 1)

HTTP Transport Settings

  • http.netty.worker_count - HTTP worker thread count
  • http.tcp.no_delay - TCP no delay setting
  • http.tcp.keep_alive - TCP keep alive setting
  • http.tcp.send_buffer_size - TCP send buffer size
  • http.tcp.receive_buffer_size - TCP receive buffer size

Note: This plugin is deprecated in favor of the newer Netty 4 implementation. It maintains backward compatibility for systems requiring Netty 3 specifically.