Netty 4 based transport implementation plugin for Elasticsearch providing high-performance networking layer for HTTP and node-to-node communications
—
The plugin framework provides the core integration between Netty4 transport implementation and Elasticsearch's plugin system. The main Netty4Plugin class serves as the entry point for registering transport and HTTP server implementations.
Primary plugin class that implements NetworkPlugin interface to provide Netty4-based transport implementations to Elasticsearch.
/**
* Main plugin class providing Netty4 transport and HTTP transport implementations
*/
public class Netty4Plugin extends Plugin implements NetworkPlugin {
public static final String NETTY_TRANSPORT_NAME = "netty4";
public static final String NETTY_HTTP_TRANSPORT_NAME = "netty4";
}Returns all configuration settings supported by the Netty4 transport and HTTP implementations.
/**
* Returns list of all settings used by Netty4 transport and HTTP implementations
* @return List of Setting objects for configuration
*/
public List<Setting<?>> getSettings();Usage Example:
Netty4Plugin plugin = new Netty4Plugin();
List<Setting<?>> allSettings = plugin.getSettings();
// Settings include transport and HTTP configuration options:
// - Netty4Transport.WORKER_COUNT
// - Netty4Transport.NETTY_RECEIVE_PREDICTOR_SIZE
// - Netty4HttpServerTransport.SETTING_HTTP_WORKER_COUNT
// - Netty4HttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS
// And others...Provides default settings that configure Netty4 as the default transport and HTTP transport implementation.
/**
* Returns default settings that set Netty4 as default transport and HTTP transport
* @return Settings object with default transport type configuration
*/
public Settings additionalSettings();Usage Example:
Netty4Plugin plugin = new Netty4Plugin();
Settings defaults = plugin.additionalSettings();
// Defaults include:
// NetworkModule.HTTP_DEFAULT_TYPE_SETTING = "netty4"
// NetworkModule.TRANSPORT_DEFAULT_TYPE_SETTING = "netty4"Registers the Netty4 transport implementation factory with Elasticsearch's transport system.
/**
* Provides transport implementation factory for Netty4 TCP transport
* @param settings Node settings
* @param threadPool Thread pool for async operations
* @param pageCacheRecycler Page cache recycler for memory management
* @param circuitBreakerService Circuit breaker for resource protection
* @param namedWriteableRegistry Registry for serializable objects
* @param networkService Network service for address resolution
* @return Map containing "netty4" transport factory
*/
public Map<String, Supplier<Transport>> getTransports(
Settings settings,
ThreadPool threadPool,
PageCacheRecycler pageCacheRecycler,
CircuitBreakerService circuitBreakerService,
NamedWriteableRegistry namedWriteableRegistry,
NetworkService networkService
);Usage Example:
Netty4Plugin plugin = new Netty4Plugin();
Map<String, Supplier<Transport>> transports = plugin.getTransports(
settings, threadPool, pageCacheRecycler, circuitBreakerService,
namedWriteableRegistry, networkService
);
// Get the Netty4 transport instance
Transport netty4Transport = transports.get("netty4").get();Registers the Netty4 HTTP server transport implementation factory with Elasticsearch's HTTP system.
/**
* Provides HTTP server transport implementation factory for Netty4 HTTP server
* @param settings Node settings
* @param threadPool Thread pool for async operations
* @param bigArrays Big arrays for large buffer management
* @param pageCacheRecycler Page cache recycler for memory management
* @param circuitBreakerService Circuit breaker for resource protection
* @param xContentRegistry Registry for content type handling
* @param networkService Network service for address resolution
* @param dispatcher HTTP request dispatcher
* @param perRequestThreadContext Per-request thread context handler
* @param clusterSettings Cluster settings for dynamic configuration
* @return Map containing "netty4" HTTP transport factory
*/
public Map<String, Supplier<HttpServerTransport>> getHttpTransports(
Settings settings,
ThreadPool threadPool,
BigArrays bigArrays,
PageCacheRecycler pageCacheRecycler,
CircuitBreakerService circuitBreakerService,
NamedXContentRegistry xContentRegistry,
NetworkService networkService,
HttpServerTransport.Dispatcher dispatcher,
BiConsumer<HttpPreRequest, ThreadContext> perRequestThreadContext,
ClusterSettings clusterSettings
);Usage Example:
Netty4Plugin plugin = new Netty4Plugin();
Map<String, Supplier<HttpServerTransport>> httpTransports = plugin.getHttpTransports(
settings, threadPool, bigArrays, pageCacheRecycler, circuitBreakerService,
xContentRegistry, networkService, dispatcher, perRequestThreadContext, clusterSettings
);
// Get the Netty4 HTTP server transport instance
HttpServerTransport httpTransport = httpTransports.get("netty4").get();Internal method for accessing shared EventLoopGroup factory used by both transport and HTTP implementations.
/**
* Gets or creates shared EventLoopGroup factory for resource sharing
* @param settings Configuration settings
* @return SharedGroupFactory instance for managing Netty EventLoopGroups
*/
private SharedGroupFactory getSharedGroupFactory(Settings settings);// Transport and HTTP implementation identifiers
public static final String NETTY_TRANSPORT_NAME = "netty4";
public static final String NETTY_HTTP_TRANSPORT_NAME = "netty4";The plugin integrates with Elasticsearch through several key mechanisms:
getSettings() are registered with Elasticsearch's settings systemadditionalSettings() configures Netty4 as the default transport implementationThe plugin follows Elasticsearch's plugin architecture patterns and integrates seamlessly with the node lifecycle and configuration system.
Install with Tessl CLI
npx tessl i tessl/maven-org-elasticsearch-plugin--transport-netty4-client