This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d9be44f67d6 CAMEL-22333 Fixed Additional Netty Bootstrap Options For
Producers (#18906)
d9be44f67d6 is described below
commit d9be44f67d6ada0917a0b541dc3e67b5c094e11f
Author: mui <[email protected]>
AuthorDate: Fri Aug 15 08:52:16 2025 +0300
CAMEL-22333 Fixed Additional Netty Bootstrap Options For Producers (#18906)
* CAMEL-22333 netty additional bootstrap channel options can be set on
producer endpoints
---
.../camel/component/netty/http/netty-http.json | 28 ++++-----
.../org/apache/camel/component/netty/netty.json | 52 ++++++++---------
.../camel/component/netty/NettyConfiguration.java | 6 +-
.../camel/component/netty/NettyProducer.java | 25 +++++---
.../netty/NettyServerBootstrapConfiguration.java | 68 +++++++++++++++++++++-
.../netty/NettyUDPProducerOptionsTest.java | 52 +++++++++++++++++
6 files changed, 177 insertions(+), 54 deletions(-)
diff --git
a/components/camel-netty-http/src/generated/resources/META-INF/org/apache/camel/component/netty/http/netty-http.json
b/components/camel-netty-http/src/generated/resources/META-INF/org/apache/camel/component/netty/http/netty-http.json
index 0b17e2980c1..a3e6401094c 100644
---
a/components/camel-netty-http/src/generated/resources/META-INF/org/apache/camel/component/netty/http/netty-http.json
+++
b/components/camel-netty-http/src/generated/resources/META-INF/org/apache/camel/component/netty/http/netty-http.json
@@ -32,20 +32,20 @@
"reuseChannel": { "index": 4, "kind": "property", "displayName": "Reuse
Channel", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "This option allows producers and consumers (in
client mode) to reuse the same Netty Channel fo [...]
"sync": { "index": 5, "kind": "property", "displayName": "Sync", "group":
"common", "label": "", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to set endpoint as one-way (false) or
request-response (true)" },
"tcpNoDelay": { "index": 6, "kind": "property", "displayName": "Tcp No
Delay", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to improve TCP protocol performance" },
- "bridgeErrorHandler": { "index": 7, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
- "clientMode": { "index": 8, "kind": "property", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
- "muteException": { "index": 9, "kind": "property", "displayName": "Mute
Exception", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "If enabled and
an Exchange failed processing on the consumer side the response's body won't
contain the exception's stack trace." },
- "reconnect": { "index": 10, "kind": "property", "displayName":
"Reconnect", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if t [...]
- "reconnectInterval": { "index": 11, "kind": "property", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to attem [...]
- "backlog": { "index": 12, "kind": "property", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort depending [...]
- "bossCount": { "index": 13, "kind": "property", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, which [...]
- "bossGroup": { "index": 14, "kind": "property", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of th [...]
- "broadcast": { "index": 15, "kind": "property", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
- "disconnectOnNoReply": { "index": 16, "kind": "property", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCons [...]
- "executorService": { "index": 17, "kind": "property", "displayName":
"Executor Service", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"io.netty.util.concurrent.EventExecutorGroup", "deprecated": false,
"autowired": false, "secret": false, "description": "To use the given custom
EventExecutorGroup." },
- "maximumPoolSize": { "index": 18, "kind": "property", "displayName":
"Maximum Pool Size", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
a maximum thread pool size for the netty consumer ordered thread pool. The
default size is 2 x cpu_core plus 1. Setting this value to eg 10 will then use
10 threads unless 2 x cpu_core plus 1 is a hig [...]
- "nettyServerBootstrapFactory": { "index": 19, "kind": "property",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a [...]
- "networkInterface": { "index": 20, "kind": "property", "displayName":
"Network Interface", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "When using UDP then this
option can be used to specify a network interface b [...]
+ "networkInterface": { "index": 7, "kind": "property", "displayName":
"Network Interface", "group": "common (advanced)", "label": "common,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When using UDP then this option can be used to
specify a network interface by its [...]
+ "bridgeErrorHandler": { "index": 8, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
+ "clientMode": { "index": 9, "kind": "property", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
+ "muteException": { "index": 10, "kind": "property", "displayName": "Mute
Exception", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "If enabled and
an Exchange failed processing on the consumer side the response's body won't
contain the exception's stack trace." },
+ "reconnect": { "index": 11, "kind": "property", "displayName":
"Reconnect", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if t [...]
+ "reconnectInterval": { "index": 12, "kind": "property", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to attem [...]
+ "backlog": { "index": 13, "kind": "property", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort depending [...]
+ "bossCount": { "index": 14, "kind": "property", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, which [...]
+ "bossGroup": { "index": 15, "kind": "property", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of th [...]
+ "broadcast": { "index": 16, "kind": "property", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
+ "disconnectOnNoReply": { "index": 17, "kind": "property", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCons [...]
+ "executorService": { "index": 18, "kind": "property", "displayName":
"Executor Service", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"io.netty.util.concurrent.EventExecutorGroup", "deprecated": false,
"autowired": false, "secret": false, "description": "To use the given custom
EventExecutorGroup." },
+ "maximumPoolSize": { "index": 19, "kind": "property", "displayName":
"Maximum Pool Size", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
a maximum thread pool size for the netty consumer ordered thread pool. The
default size is 2 x cpu_core plus 1. Setting this value to eg 10 will then use
10 threads unless 2 x cpu_core plus 1 is a hig [...]
+ "nettyServerBootstrapFactory": { "index": 20, "kind": "property",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a [...]
"noReplyLogLevel": { "index": 21, "kind": "property", "displayName": "No
Reply Log Level", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG", "INFO", "WARN",
"ERROR", "OFF" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configura [...]
"serverClosedChannelExceptionCaughtLogLevel": { "index": 22, "kind":
"property", "displayName": "Server Closed Channel Exception Caught Log Level",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "org.apache.camel.LoggingLevel", "enum": [
"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "DEBUG",
"configurationClass": "org.apache.camel.component.n [...]
"serverExceptionCaughtLogLevel": { "index": 23, "kind": "property",
"displayName": "Server Exception Caught Log Level", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG",
"INFO", "WARN", "ERROR", "OFF" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "co [...]
diff --git
a/components/camel-netty/src/generated/resources/META-INF/org/apache/camel/component/netty/netty.json
b/components/camel-netty/src/generated/resources/META-INF/org/apache/camel/component/netty/netty.json
index e45b4bcfd80..6c3e9272da9 100644
---
a/components/camel-netty/src/generated/resources/META-INF/org/apache/camel/component/netty/netty.json
+++
b/components/camel-netty/src/generated/resources/META-INF/org/apache/camel/component/netty/netty.json
@@ -31,19 +31,19 @@
"reuseChannel": { "index": 4, "kind": "property", "displayName": "Reuse
Channel", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "This option allows producers and consumers (in
client mode) to reuse the same Netty Channel fo [...]
"sync": { "index": 5, "kind": "property", "displayName": "Sync", "group":
"common", "label": "", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to set endpoint as one-way (false) or
request-response (true)" },
"tcpNoDelay": { "index": 6, "kind": "property", "displayName": "Tcp No
Delay", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to improve TCP protocol performance" },
- "bridgeErrorHandler": { "index": 7, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
- "clientMode": { "index": 8, "kind": "property", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
- "reconnect": { "index": 9, "kind": "property", "displayName": "Reconnect",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if th [...]
- "reconnectInterval": { "index": 10, "kind": "property", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to attem [...]
- "backlog": { "index": 11, "kind": "property", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort depending [...]
- "bossCount": { "index": 12, "kind": "property", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, which [...]
- "bossGroup": { "index": 13, "kind": "property", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of th [...]
- "broadcast": { "index": 14, "kind": "property", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
- "disconnectOnNoReply": { "index": 15, "kind": "property", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCons [...]
- "executorService": { "index": 16, "kind": "property", "displayName":
"Executor Service", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"io.netty.util.concurrent.EventExecutorGroup", "deprecated": false,
"autowired": false, "secret": false, "description": "To use the given custom
EventExecutorGroup." },
- "maximumPoolSize": { "index": 17, "kind": "property", "displayName":
"Maximum Pool Size", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
a maximum thread pool size for the netty consumer ordered thread pool. The
default size is 2 x cpu_core plus 1. Setting this value to eg 10 will then use
10 threads unless 2 x cpu_core plus 1 is a hig [...]
- "nettyServerBootstrapFactory": { "index": 18, "kind": "property",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a [...]
- "networkInterface": { "index": 19, "kind": "property", "displayName":
"Network Interface", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "When using UDP then this
option can be used to specify a network interface b [...]
+ "networkInterface": { "index": 7, "kind": "property", "displayName":
"Network Interface", "group": "common (advanced)", "label": "common,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When using UDP then this option can be used to
specify a network interface by its [...]
+ "bridgeErrorHandler": { "index": 8, "kind": "property", "displayName":
"Bridge Error Handler", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Allows for bridging the consumer to the Camel routing Error Handler, which
mean any exceptions (if possible) occurred while the Camel consumer is trying
to pickup incoming messages, or the like [...]
+ "clientMode": { "index": 9, "kind": "property", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
+ "reconnect": { "index": 10, "kind": "property", "displayName":
"Reconnect", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if t [...]
+ "reconnectInterval": { "index": 11, "kind": "property", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to attem [...]
+ "backlog": { "index": 12, "kind": "property", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort depending [...]
+ "bossCount": { "index": 13, "kind": "property", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, which [...]
+ "bossGroup": { "index": 14, "kind": "property", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of th [...]
+ "broadcast": { "index": 15, "kind": "property", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
+ "disconnectOnNoReply": { "index": 16, "kind": "property", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCons [...]
+ "executorService": { "index": 17, "kind": "property", "displayName":
"Executor Service", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"io.netty.util.concurrent.EventExecutorGroup", "deprecated": false,
"autowired": false, "secret": false, "description": "To use the given custom
EventExecutorGroup." },
+ "maximumPoolSize": { "index": 18, "kind": "property", "displayName":
"Maximum Pool Size", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
a maximum thread pool size for the netty consumer ordered thread pool. The
default size is 2 x cpu_core plus 1. Setting this value to eg 10 will then use
10 threads unless 2 x cpu_core plus 1 is a hig [...]
+ "nettyServerBootstrapFactory": { "index": 19, "kind": "property",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a [...]
"noReplyLogLevel": { "index": 20, "kind": "property", "displayName": "No
Reply Log Level", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG", "INFO", "WARN",
"ERROR", "OFF" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configura [...]
"serverClosedChannelExceptionCaughtLogLevel": { "index": 21, "kind":
"property", "displayName": "Server Closed Channel Exception Caught Log Level",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "org.apache.camel.LoggingLevel", "enum": [
"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "DEBUG",
"configurationClass": "org.apache.camel.component.n [...]
"serverExceptionCaughtLogLevel": { "index": 22, "kind": "property",
"displayName": "Server Exception Caught Log Level", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG",
"INFO", "WARN", "ERROR", "OFF" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "co [...]
@@ -126,19 +126,19 @@
"reuseChannel": { "index": 6, "kind": "parameter", "displayName": "Reuse
Channel", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "This option allows producers and consumers (in
client mode) to reuse the same Netty Channel f [...]
"sync": { "index": 7, "kind": "parameter", "displayName": "Sync", "group":
"common", "label": "", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to set endpoint as one-way (false) or
request-response (true)" },
"tcpNoDelay": { "index": 8, "kind": "parameter", "displayName": "Tcp No
Delay", "group": "common", "label": "", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Setting to improve TCP protocol performance" },
- "clientMode": { "index": 9, "kind": "parameter", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
- "reconnect": { "index": 10, "kind": "parameter", "displayName":
"Reconnect", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if [...]
- "reconnectInterval": { "index": 11, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to atte [...]
- "backlog": { "index": 12, "kind": "parameter", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort dependin [...]
- "bossCount": { "index": 13, "kind": "parameter", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, whic [...]
- "bossGroup": { "index": 14, "kind": "parameter", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of t [...]
- "bridgeErrorHandler": { "index": 15, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
- "broadcast": { "index": 16, "kind": "parameter", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
- "disconnectOnNoReply": { "index": 17, "kind": "parameter", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCon [...]
- "exceptionHandler": { "index": 18, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
- "exchangePattern": { "index": 19, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
- "nettyServerBootstrapFactory": { "index": 20, "kind": "parameter",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use [...]
- "networkInterface": { "index": 21, "kind": "parameter", "displayName":
"Network Interface", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "When using UDP then this
option can be used to specify a network interface [...]
+ "networkInterface": { "index": 9, "kind": "parameter", "displayName":
"Network Interface", "group": "common (advanced)", "label": "common,advanced",
"required": false, "type": "string", "javaType": "java.lang.String",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When using UDP then this option can be used to
specify a network interface by it [...]
+ "clientMode": { "index": 10, "kind": "parameter", "displayName": "Client
Mode", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If the clientMode is true, netty consumer will
connect the address as a TCP client." },
+ "reconnect": { "index": 11, "kind": "parameter", "displayName":
"Reconnect", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used only in clientMode in consumer, the
consumer will attempt to reconnect on disconnection if [...]
+ "reconnectInterval": { "index": 12, "kind": "parameter", "displayName":
"Reconnect Interval", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 10000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Used if reconnect and clientMode is enabled.
The interval in milli seconds to atte [...]
+ "backlog": { "index": 13, "kind": "parameter", "displayName": "Backlog",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Allows to configure a backlog for netty
consumer (server). Note the backlog is just a best effort dependin [...]
+ "bossCount": { "index": 14, "kind": "parameter", "displayName": "Boss
Count", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "When netty works on nio mode, it uses default
bossCount parameter from Netty, whic [...]
+ "bossGroup": { "index": 15, "kind": "parameter", "displayName": "Boss
Group", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"io.netty.channel.EventLoopGroup", "deprecated": false, "autowired": false,
"secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Set the BossGroup which could be used for
handling the new connection of t [...]
+ "bridgeErrorHandler": { "index": 16, "kind": "parameter", "displayName":
"Bridge Error Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions (if possible) occurred
while the Camel consumer is trying to pickup incoming [...]
+ "broadcast": { "index": 17, "kind": "parameter", "displayName":
"Broadcast", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"configurationClass": "org.apache.camel.component.netty.NettyConfiguration",
"configurationField": "configuration", "description": "Setting to choose
Multicast over UDP" },
+ "disconnectOnNoReply": { "index": 18, "kind": "parameter", "displayName":
"Disconnect On No Reply", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "If sync is enabled then this option dictates
NettyCon [...]
+ "exceptionHandler": { "index": 19, "kind": "parameter", "displayName":
"Exception Handler", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By de [...]
+ "exchangePattern": { "index": 20, "kind": "parameter", "displayName":
"Exchange Pattern", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ],
"deprecated": false, "autowired": false, "secret": false, "description": "Sets
the exchange pattern when the consumer creates an exchange." },
+ "nettyServerBootstrapFactory": { "index": 21, "kind": "parameter",
"displayName": "Netty Server Bootstrap Factory", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.component.netty.NettyServerBootstrapFactory",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use [...]
"noReplyLogLevel": { "index": 22, "kind": "parameter", "displayName": "No
Reply Log Level", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG", "INFO", "WARN",
"ERROR", "OFF" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configur [...]
"serverClosedChannelExceptionCaughtLogLevel": { "index": 23, "kind":
"parameter", "displayName": "Server Closed Channel Exception Caught Log Level",
"group": "consumer (advanced)", "label": "consumer,advanced", "required":
false, "type": "object", "javaType": "org.apache.camel.LoggingLevel", "enum": [
"TRACE", "DEBUG", "INFO", "WARN", "ERROR", "OFF" ], "deprecated": false,
"autowired": false, "secret": false, "defaultValue": "DEBUG",
"configurationClass": "org.apache.camel.component. [...]
"serverExceptionCaughtLogLevel": { "index": 24, "kind": "parameter",
"displayName": "Server Exception Caught Log Level", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.LoggingLevel", "enum": [ "TRACE", "DEBUG",
"INFO", "WARN", "ERROR", "OFF" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "WARN", "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "c [...]
diff --git
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
index e4c21eeac6e..de164628ae7 100644
---
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
+++
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConfiguration.java
@@ -308,11 +308,7 @@ public class NettyConfiguration extends
NettyServerBootstrapConfiguration implem
.withProperties(parameters)
.bind();
- // additional netty options, we don't want to store an empty map, so
set it as null if empty
- options = PropertiesHelper.extractProperties(parameters, "option.");
- if (options.isEmpty()) {
- options = null;
- }
+ addAdditionalOptions(PropertiesHelper.extractProperties(parameters,
"option."));
// add default encoders and decoders
if (encodersList.isEmpty() && decodersList.isEmpty()) {
diff --git
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index 725c310dbb2..04e7eef6180 100644
---
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -18,9 +18,11 @@ package org.apache.camel.component.netty;
import java.net.ConnectException;
import java.net.InetSocketAddress;
+import java.net.NetworkInterface;
import java.net.SocketAddress;
import java.nio.file.Path;
import java.time.Duration;
+import java.util.Map;
import java.util.Optional;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
@@ -491,14 +493,15 @@ public class NettyProducer extends DefaultAsyncProducer {
}
clientBootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,
configuration.getConnectTimeout());
- //TODO need to check it later;
// set any additional netty options
- /*
if (configuration.getOptions() != null) {
for (Map.Entry<String, Object> entry :
configuration.getOptions().entrySet()) {
- clientBootstrap.setOption(entry.getKey(),
entry.getValue());
+ // child Channel Option can not be added to Client
Bootstrap
+ if (!entry.getKey().contains("child.")) {
+
clientBootstrap.option(ChannelOption.valueOf(entry.getKey()), entry.getValue());
+ }
}
- }*/
+ }
// set the pipeline factory, which creates the pipeline for each
newly created channels
clientBootstrap.handler(pipelineFactory);
@@ -530,14 +533,20 @@ public class NettyProducer extends DefaultAsyncProducer {
connectionlessClientBootstrap.option(ChannelOption.SO_SNDBUF,
configuration.getSendBufferSize());
connectionlessClientBootstrap.option(ChannelOption.SO_RCVBUF,
configuration.getReceiveBufferSize());
- //TODO need to check it later
+ if (configuration.getNetworkInterface() != null) {
+
connectionlessClientBootstrap.option(ChannelOption.IP_MULTICAST_IF,
+
NetworkInterface.getByName(configuration.getNetworkInterface()));
+ }
+
// set any additional netty options
- /*
if (configuration.getOptions() != null) {
for (Map.Entry<String, Object> entry :
configuration.getOptions().entrySet()) {
- connectionlessClientBootstrap.setOption(entry.getKey(),
entry.getValue());
+ // child Channel Option can not be added to Client
Bootstrap
+ if (!entry.getKey().contains("child.")) {
+
connectionlessClientBootstrap.option(ChannelOption.valueOf(entry.getKey()),
entry.getValue());
+ }
}
- }*/
+ }
// set the pipeline factory, which creates the pipeline for each
newly created channels
connectionlessClientBootstrap.handler(pipelineFactory);
diff --git
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java
index 05f612563ad..aba7834ec36 100644
---
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java
+++
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyServerBootstrapConfiguration.java
@@ -17,9 +17,11 @@
package org.apache.camel.component.netty;
import java.io.File;
+import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
+import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.group.ChannelGroup;
import io.netty.handler.ssl.SslHandler;
@@ -138,7 +140,7 @@ public class NettyServerBootstrapConfiguration implements
Cloneable {
protected EventLoopGroup workerGroup;
@UriParam(label = "advanced", description = "To use an explicit
ChannelGroup.")
protected ChannelGroup channelGroup;
- @UriParam(label = "consumer,advanced",
+ @UriParam(label = "common,advanced",
description = "When using UDP then this option can be used to
specify a network interface by its name, such as eth0 to join a multicast
group.")
protected String networkInterface;
@UriParam(label = "consumer", defaultValue = "true",
@@ -165,6 +167,70 @@ public class NettyServerBootstrapConfiguration implements
Cloneable {
return protocol.equalsIgnoreCase("tcp");
}
+ public void addAdditionalOptions(Map<String, Object> extractedOptions) {
+ // additional netty options, we don't want to store an empty map, so
set it as null if empty
+ if (extractedOptions.isEmpty()) {
+ options = null;
+ } else {
+ if (options == null) {
+ options = new HashMap<>();
+ }
+ extractedOptions.forEach((key, value) -> {
+ Object val = getOptionValue(key, (String) value);
+ if (val != null) {
+ options.put(key, val);
+ }
+ });
+ }
+ }
+
+ public Object getOptionValue(String option, String value) {
+ if (option.contains(ChannelOption.CONNECT_TIMEOUT_MILLIS.name())) {
+ return Integer.valueOf(value);
+ } else if
(option.contains(ChannelOption.MAX_MESSAGES_PER_WRITE.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.WRITE_SPIN_COUNT.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.ALLOW_HALF_CLOSURE.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.AUTO_READ.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.AUTO_CLOSE.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_BROADCAST.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_KEEPALIVE.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_SNDBUF.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_RCVBUF.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_REUSEADDR.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_LINGER.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_BACKLOG.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.SO_TIMEOUT.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.IP_TOS.name())) {
+ return Integer.valueOf(value);
+ } else if (option.contains(ChannelOption.IP_MULTICAST_TTL.name())) {
+ return Integer.valueOf(value);
+ } else if
(option.contains(ChannelOption.IP_MULTICAST_LOOP_DISABLED.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.TCP_NODELAY.name())) {
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.TCP_FASTOPEN_CONNECT.name()))
{
+ return Boolean.valueOf(value);
+ } else if (option.contains(ChannelOption.TCP_FASTOPEN.name())) {
+ return Integer.valueOf(value);
+ } else if
(option.contains(ChannelOption.SINGLE_EVENTEXECUTOR_PER_GROUP.name())) {
+ return Boolean.valueOf(value);
+ }
+ return null;
+ }
+
public String getProtocol() {
return protocol;
}
diff --git
a/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPProducerOptionsTest.java
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPProducerOptionsTest.java
new file mode 100644
index 00000000000..c3a33c7ff89
--- /dev/null
+++
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/NettyUDPProducerOptionsTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.netty;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Test;
+
+public class NettyUDPProducerOptionsTest extends BaseNettyTest {
+
+ @Test
+ public void testUDPInOnlyMulticastWithNettyConsumer() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ template.sendBody("direct:sendMessage", "Hello World");
+
+ mock.assertIsSatisfied();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+
from("netty:udp://230.0.0.5:{{port}}?sync=false&networkInterface=lo")
+ .log("Received message: ${body}")
+ .to("mock:result");
+
+ from("direct:sendMessage")
+ .log("Sending message: ${body}")
+
.to("netty:udp://230.0.0.5:{{port}}?sync=false&networkInterface=lo&option.IP_MULTICAST_TTL=188");
+ }
+ };
+ }
+
+}