or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

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

plugin-registration.mddocs/

0

# Plugin Registration

1

2

Main plugin entry point that provides transport factories for Elasticsearch's networking layer. This capability registers the plugin with Elasticsearch and exposes available configuration settings.

3

4

## Capabilities

5

6

### Netty3Plugin Class

7

8

The main plugin class that implements Elasticsearch's NetworkPlugin interface to provide Netty 3-based transport implementations.

9

10

```java { .api }

11

/**

12

* Main plugin class that registers Netty 3 transport implementations with Elasticsearch

13

*/

14

public class Netty3Plugin extends Plugin implements NetworkPlugin {

15

/**

16

* Transport name identifier for TCP transport

17

*/

18

public static final String NETTY_TRANSPORT_NAME = "netty3";

19

20

/**

21

* Transport name identifier for HTTP transport

22

*/

23

public static final String NETTY_HTTP_TRANSPORT_NAME = "netty3";

24

25

/**

26

* Returns all configuration settings exposed by this plugin

27

* @return List of Setting objects for plugin configuration

28

*/

29

public List<Setting<?>> getSettings();

30

31

/**

32

* Provides TCP transport factory for internal cluster communication

33

* @param settings Elasticsearch settings

34

* @param threadPool Thread pool for async operations

35

* @param bigArrays Memory management for large arrays

36

* @param circuitBreakerService Circuit breaker for memory protection

37

* @param namedWriteableRegistry Registry for serializable objects

38

* @param networkService Network utility service

39

* @return Map containing transport name and factory supplier

40

*/

41

public Map<String, Supplier<Transport>> getTransports(

42

Settings settings,

43

ThreadPool threadPool,

44

BigArrays bigArrays,

45

CircuitBreakerService circuitBreakerService,

46

NamedWriteableRegistry namedWriteableRegistry,

47

NetworkService networkService

48

);

49

50

/**

51

* Provides HTTP transport factory for REST API communication

52

* @param settings Elasticsearch settings

53

* @param threadPool Thread pool for async operations

54

* @param bigArrays Memory management for large arrays

55

* @param circuitBreakerService Circuit breaker for memory protection

56

* @param namedWriteableRegistry Registry for serializable objects

57

* @param xContentRegistry Registry for content parsers

58

* @param networkService Network utility service

59

* @param dispatcher HTTP request dispatcher

60

* @return Map containing HTTP transport name and factory supplier

61

*/

62

public Map<String, Supplier<HttpServerTransport>> getHttpTransports(

63

Settings settings,

64

ThreadPool threadPool,

65

BigArrays bigArrays,

66

CircuitBreakerService circuitBreakerService,

67

NamedWriteableRegistry namedWriteableRegistry,

68

NamedXContentRegistry xContentRegistry,

69

NetworkService networkService,

70

HttpServerTransport.Dispatcher dispatcher

71

);

72

}

73

```

74

75

**Usage Example:**

76

77

```java

78

import org.elasticsearch.transport.Netty3Plugin;

79

import org.elasticsearch.common.settings.Settings;

80

81

// Plugin registration is handled automatically by Elasticsearch

82

// when the plugin is installed, but you can access it programmatically

83

Netty3Plugin plugin = new Netty3Plugin();

84

85

// Get all available settings for this plugin

86

List<Setting<?>> availableSettings = plugin.getSettings();

87

88

// Configure Elasticsearch to use netty3 transports

89

Settings settings = Settings.builder()

90

.put("transport.type", Netty3Plugin.NETTY_TRANSPORT_NAME)

91

.put("http.type", Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)

92

.build();

93

```

94

95

### Plugin Settings

96

97

The plugin exposes all transport-specific configuration settings through the `getSettings()` method. These settings are automatically registered with Elasticsearch's configuration system.

98

99

```java { .api }

100

/**

101

* Complete list of settings exposed by the plugin, including:

102

* - All Netty3Transport settings (TCP transport configuration)

103

* - All Netty3HttpServerTransport settings (HTTP transport configuration)

104

*/

105

public List<Setting<?>> getSettings() {

106

return Arrays.asList(

107

// HTTP transport settings

108

Netty3HttpServerTransport.SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY,

109

Netty3HttpServerTransport.SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,

110

Netty3HttpServerTransport.SETTING_HTTP_WORKER_COUNT,

111

Netty3HttpServerTransport.SETTING_HTTP_TCP_NO_DELAY,

112

Netty3HttpServerTransport.SETTING_HTTP_TCP_KEEP_ALIVE,

113

Netty3HttpServerTransport.SETTING_HTTP_TCP_BLOCKING_SERVER,

114

Netty3HttpServerTransport.SETTING_HTTP_TCP_REUSE_ADDRESS,

115

Netty3HttpServerTransport.SETTING_HTTP_TCP_SEND_BUFFER_SIZE,

116

Netty3HttpServerTransport.SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE,

117

118

// TCP transport settings

119

Netty3Transport.WORKER_COUNT,

120

Netty3Transport.NETTY_MAX_CUMULATION_BUFFER_CAPACITY,

121

Netty3Transport.NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS,

122

Netty3Transport.NETTY_RECEIVE_PREDICTOR_SIZE,

123

Netty3Transport.NETTY_RECEIVE_PREDICTOR_MIN,

124

Netty3Transport.NETTY_RECEIVE_PREDICTOR_MAX,

125

Netty3Transport.NETTY_BOSS_COUNT

126

);

127

}

128

```

129

130

### Transport Factory Methods

131

132

The plugin provides factory methods that create transport instances with appropriate configuration.

133

134

```java { .api }

135

/**

136

* TCP transport factory - returns a single entry map with the transport implementation

137

*/

138

public Map<String, Supplier<Transport>> getTransports(...) {

139

return Collections.singletonMap(NETTY_TRANSPORT_NAME,

140

() -> new Netty3Transport(settings, threadPool, networkService,

141

bigArrays, namedWriteableRegistry, circuitBreakerService));

142

}

143

144

/**

145

* HTTP transport factory - returns a single entry map with the HTTP transport implementation

146

*/

147

public Map<String, Supplier<HttpServerTransport>> getHttpTransports(...) {

148

return Collections.singletonMap(NETTY_HTTP_TRANSPORT_NAME,

149

() -> new Netty3HttpServerTransport(settings, networkService, bigArrays,

150

threadPool, xContentRegistry, dispatcher));

151

}

152

```

153

154

## Static Initialization

155

156

The plugin performs static initialization to set up Netty 3 utilities:

157

158

```java { .api }

159

static {

160

Netty3Utils.setup();

161

}

162

```

163

164

This static block ensures that Netty 3 logging and thread naming are properly configured when the plugin class is loaded.

165

166

## Plugin Integration

167

168

The plugin integrates with Elasticsearch's plugin system through the standard plugin discovery mechanism. Once installed, it becomes available for configuration through Elasticsearch settings files or programmatic configuration.

169

170

## Configuration Setting Objects

171

172

The plugin exposes detailed configuration settings for both TCP and HTTP transports. All settings are static final objects that can be referenced directly.

173

174

### TCP Transport Setting Objects

175

176

All TCP transport settings are defined in the `Netty3Transport` class:

177

178

```java { .api }

179

/**

180

* Number of worker threads for TCP transport

181

* Setting key: "transport.netty.worker_count"

182

* Default: 2 * number of processors

183

* Range: minimum 1

184

*/

185

public static final Setting<Integer> WORKER_COUNT;

186

187

/**

188

* Maximum cumulation buffer capacity for TCP transport

189

* Setting key: "transport.netty.max_cumulation_buffer_capacity"

190

* Default: -1 (unlimited)

191

*/

192

public static final Setting<ByteSizeValue> NETTY_MAX_CUMULATION_BUFFER_CAPACITY;

193

194

/**

195

* Maximum composite buffer components for TCP transport

196

* Setting key: "transport.netty.max_composite_buffer_components"

197

* Default: -1 (unlimited)

198

* Range: minimum -1

199

*/

200

public static final Setting<Integer> NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;

201

202

/**

203

* Receive buffer size predictor for TCP transport

204

* Setting key: "transport.netty.receive_predictor_size"

205

* Default: 512KB (automatically calculated based on available direct memory and worker count)

206

*/

207

public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_SIZE;

208

209

/**

210

* Minimum receive buffer size for TCP transport

211

* Setting key: "transport.netty.receive_predictor_min"

212

* Default: Same as NETTY_RECEIVE_PREDICTOR_SIZE

213

*/

214

public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MIN;

215

216

/**

217

* Maximum receive buffer size for TCP transport

218

* Setting key: "transport.netty.receive_predictor_max"

219

* Default: Same as NETTY_RECEIVE_PREDICTOR_SIZE

220

*/

221

public static final Setting<ByteSizeValue> NETTY_RECEIVE_PREDICTOR_MAX;

222

223

/**

224

* Number of boss threads for TCP transport

225

* Setting key: "transport.netty.boss_count"

226

* Default: 1

227

* Range: minimum 1

228

*/

229

public static final Setting<Integer> NETTY_BOSS_COUNT;

230

```

231

232

### HTTP Transport Setting Objects

233

234

All HTTP transport settings are defined in the `Netty3HttpServerTransport` class:

235

236

```java { .api }

237

/**

238

* Maximum cumulation buffer capacity for HTTP transport

239

* Setting key: "http.netty.max_cumulation_buffer_capacity"

240

* Default: -1 (unlimited)

241

*/

242

public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_MAX_CUMULATION_BUFFER_CAPACITY;

243

244

/**

245

* Maximum composite buffer components for HTTP transport

246

* Setting key: "http.netty.max_composite_buffer_components"

247

* Default: -1 (unlimited)

248

*/

249

public static final Setting<Integer> SETTING_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS;

250

251

/**

252

* Number of worker threads for HTTP transport

253

* Setting key: "http.netty.worker_count"

254

* Default: 2 * number of processors

255

* Range: minimum 1

256

*/

257

public static final Setting<Integer> SETTING_HTTP_WORKER_COUNT;

258

259

/**

260

* TCP no delay setting for HTTP transport

261

* Setting key: "http.tcp_no_delay"

262

* Default: NetworkService.TcpSettings.TCP_NO_DELAY (typically true)

263

*/

264

public static final Setting<Boolean> SETTING_HTTP_TCP_NO_DELAY;

265

266

/**

267

* TCP keep alive setting for HTTP transport

268

* Setting key: "http.tcp.keep_alive"

269

* Default: NetworkService.TcpSettings.TCP_KEEP_ALIVE (typically true)

270

*/

271

public static final Setting<Boolean> SETTING_HTTP_TCP_KEEP_ALIVE;

272

273

/**

274

* TCP blocking server setting for HTTP transport

275

* Setting key: "http.tcp.blocking_server"

276

* Default: NetworkService.TcpSettings.TCP_BLOCKING_SERVER (typically false)

277

*/

278

public static final Setting<Boolean> SETTING_HTTP_TCP_BLOCKING_SERVER;

279

280

/**

281

* TCP reuse address setting for HTTP transport

282

* Setting key: "http.tcp.reuse_address"

283

* Default: NetworkService.TcpSettings.TCP_REUSE_ADDRESS (typically true)

284

*/

285

public static final Setting<Boolean> SETTING_HTTP_TCP_REUSE_ADDRESS;

286

287

/**

288

* TCP send buffer size for HTTP transport

289

* Setting key: "http.tcp.send_buffer_size"

290

* Default: NetworkService.TcpSettings.TCP_SEND_BUFFER_SIZE

291

*/

292

public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_SEND_BUFFER_SIZE;

293

294

/**

295

* TCP receive buffer size for HTTP transport

296

* Setting key: "http.tcp.receive_buffer_size"

297

* Default: NetworkService.TcpSettings.TCP_RECEIVE_BUFFER_SIZE

298

*/

299

public static final Setting<ByteSizeValue> SETTING_HTTP_TCP_RECEIVE_BUFFER_SIZE;

300

301

/**

302

* Receive buffer size predictor for HTTP transport

303

* Setting key: "transport.netty.receive_predictor_size"

304

* Default: 512KB (automatically calculated based on available direct memory and worker count)

305

*/

306

public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE;

307

308

/**

309

* Minimum receive buffer size for HTTP transport

310

* Setting key: "http.netty.receive_predictor_min"

311

* Default: Same as SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE

312

*/

313

public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MIN;

314

315

/**

316

* Maximum receive buffer size for HTTP transport

317

* Setting key: "http.netty.receive_predictor_max"

318

* Default: Same as SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE

319

*/

320

public static final Setting<ByteSizeValue> SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_MAX;

321

```