This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.14.x by this push:
new 8ba8e760b04 CAMEL-18871: Application does not recover (threads are
WAITING) when NettyProducer pool is exhausted (#9055)
8ba8e760b04 is described below
commit 8ba8e760b042511f769ac7008b91b9482ec7cb6e
Author: VinceGall <[email protected]>
AuthorDate: Thu Jan 12 11:22:36 2023 +0100
CAMEL-18871: Application does not recover (threads are WAITING) when
NettyProducer pool is exhausted (#9055)
* CAMEL-18871 - camel-netty - Add producerPoolBlockWhenExhausted &
producerPoolMaxWait options
* CAMEL-18871 - camel-netty - Add producerPoolBlockWhenExhausted &
producerPoolMaxWait options
Co-authored-by: Vincenzo Galluccio <[email protected]>
---
.../component/netty/NettyComponentConfigurer.java | 12 +++++++++
.../netty/NettyConfigurationConfigurer.java | 12 +++++++++
.../component/netty/NettyEndpointConfigurer.java | 12 +++++++++
.../component/netty/NettyEndpointUriFactory.java | 4 ++-
.../org/apache/camel/component/netty/netty.json | 4 +++
.../camel/component/netty/NettyConfiguration.java | 30 ++++++++++++++++++++++
.../camel/component/netty/NettyProducer.java | 4 ++-
7 files changed, 76 insertions(+), 2 deletions(-)
diff --git
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
index 86ae0fda93a..65274daa322 100644
---
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
+++
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyComponentConfigurer.java
@@ -96,12 +96,16 @@ public class NettyComponentConfigurer extends
PropertyConfigurerSupport implemen
case "noReplyLogLevel":
getOrCreateConfiguration(target).setNoReplyLogLevel(property(camelContext,
org.apache.camel.LoggingLevel.class, value)); return true;
case "options":
getOrCreateConfiguration(target).setOptions(property(camelContext,
java.util.Map.class, value)); return true;
case "passphrase":
getOrCreateConfiguration(target).setPassphrase(property(camelContext,
java.lang.String.class, value)); return true;
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted":
getOrCreateConfiguration(target).setProducerPoolBlockWhenExhausted(property(camelContext,
boolean.class, value)); return true;
case "producerpoolenabled":
case "producerPoolEnabled":
getOrCreateConfiguration(target).setProducerPoolEnabled(property(camelContext,
boolean.class, value)); return true;
case "producerpoolmaxidle":
case "producerPoolMaxIdle":
getOrCreateConfiguration(target).setProducerPoolMaxIdle(property(camelContext,
int.class, value)); return true;
case "producerpoolmaxtotal":
case "producerPoolMaxTotal":
getOrCreateConfiguration(target).setProducerPoolMaxTotal(property(camelContext,
int.class, value)); return true;
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait":
getOrCreateConfiguration(target).setProducerPoolMaxWait(property(camelContext,
long.class, value)); return true;
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle":
getOrCreateConfiguration(target).setProducerPoolMinEvictableIdle(property(camelContext,
long.class, value)); return true;
case "producerpoolminidle":
@@ -235,12 +239,16 @@ public class NettyComponentConfigurer extends
PropertyConfigurerSupport implemen
case "noReplyLogLevel": return org.apache.camel.LoggingLevel.class;
case "options": return java.util.Map.class;
case "passphrase": return java.lang.String.class;
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted": return boolean.class;
case "producerpoolenabled":
case "producerPoolEnabled": return boolean.class;
case "producerpoolmaxidle":
case "producerPoolMaxIdle": return int.class;
case "producerpoolmaxtotal":
case "producerPoolMaxTotal": return int.class;
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait": return long.class;
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle": return long.class;
case "producerpoolminidle":
@@ -375,12 +383,16 @@ public class NettyComponentConfigurer extends
PropertyConfigurerSupport implemen
case "noReplyLogLevel": return
getOrCreateConfiguration(target).getNoReplyLogLevel();
case "options": return getOrCreateConfiguration(target).getOptions();
case "passphrase": return
getOrCreateConfiguration(target).getPassphrase();
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted": return
getOrCreateConfiguration(target).isProducerPoolBlockWhenExhausted();
case "producerpoolenabled":
case "producerPoolEnabled": return
getOrCreateConfiguration(target).isProducerPoolEnabled();
case "producerpoolmaxidle":
case "producerPoolMaxIdle": return
getOrCreateConfiguration(target).getProducerPoolMaxIdle();
case "producerpoolmaxtotal":
case "producerPoolMaxTotal": return
getOrCreateConfiguration(target).getProducerPoolMaxTotal();
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait": return
getOrCreateConfiguration(target).getProducerPoolMaxWait();
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle": return
getOrCreateConfiguration(target).getProducerPoolMinEvictableIdle();
case "producerpoolminidle":
diff --git
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyConfigurationConfigurer.java
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyConfigurationConfigurer.java
index 447689dcd3b..9f6e1b59847 100644
---
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyConfigurationConfigurer.java
+++
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyConfigurationConfigurer.java
@@ -97,12 +97,16 @@ public class NettyConfigurationConfigurer extends
org.apache.camel.support.compo
case "Passphrase": target.setPassphrase(property(camelContext,
java.lang.String.class, value)); return true;
case "port":
case "Port": target.setPort(property(camelContext, int.class, value));
return true;
+ case "producerpoolblockwhenexhausted":
+ case "ProducerPoolBlockWhenExhausted":
target.setProducerPoolBlockWhenExhausted(property(camelContext, boolean.class,
value)); return true;
case "producerpoolenabled":
case "ProducerPoolEnabled":
target.setProducerPoolEnabled(property(camelContext, boolean.class, value));
return true;
case "producerpoolmaxidle":
case "ProducerPoolMaxIdle":
target.setProducerPoolMaxIdle(property(camelContext, int.class, value)); return
true;
case "producerpoolmaxtotal":
case "ProducerPoolMaxTotal":
target.setProducerPoolMaxTotal(property(camelContext, int.class, value));
return true;
+ case "producerpoolmaxwait":
+ case "ProducerPoolMaxWait":
target.setProducerPoolMaxWait(property(camelContext, long.class, value));
return true;
case "producerpoolminevictableidle":
case "ProducerPoolMinEvictableIdle":
target.setProducerPoolMinEvictableIdle(property(camelContext, long.class,
value)); return true;
case "producerpoolminidle":
@@ -250,12 +254,16 @@ public class NettyConfigurationConfigurer extends
org.apache.camel.support.compo
case "Passphrase": return java.lang.String.class;
case "port":
case "Port": return int.class;
+ case "producerpoolblockwhenexhausted":
+ case "ProducerPoolBlockWhenExhausted": return boolean.class;
case "producerpoolenabled":
case "ProducerPoolEnabled": return boolean.class;
case "producerpoolmaxidle":
case "ProducerPoolMaxIdle": return int.class;
case "producerpoolmaxtotal":
case "ProducerPoolMaxTotal": return int.class;
+ case "producerpoolmaxwait":
+ case "ProducerPoolMaxWait": return long.class;
case "producerpoolminevictableidle":
case "ProducerPoolMinEvictableIdle": return long.class;
case "producerpoolminidle":
@@ -404,12 +412,16 @@ public class NettyConfigurationConfigurer extends
org.apache.camel.support.compo
case "Passphrase": return target.getPassphrase();
case "port":
case "Port": return target.getPort();
+ case "producerpoolblockwhenexhausted":
+ case "ProducerPoolBlockWhenExhausted": return
target.isProducerPoolBlockWhenExhausted();
case "producerpoolenabled":
case "ProducerPoolEnabled": return target.isProducerPoolEnabled();
case "producerpoolmaxidle":
case "ProducerPoolMaxIdle": return target.getProducerPoolMaxIdle();
case "producerpoolmaxtotal":
case "ProducerPoolMaxTotal": return target.getProducerPoolMaxTotal();
+ case "producerpoolmaxwait":
+ case "ProducerPoolMaxWait": return target.getProducerPoolMaxWait();
case "producerpoolminevictableidle":
case "ProducerPoolMinEvictableIdle": return
target.getProducerPoolMinEvictableIdle();
case "producerpoolminidle":
diff --git
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
index de52af20f45..d2e3bd826c1 100644
---
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
+++
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointConfigurer.java
@@ -86,12 +86,16 @@ public class NettyEndpointConfigurer extends
PropertyConfigurerSupport implement
case "noReplyLogLevel":
target.getConfiguration().setNoReplyLogLevel(property(camelContext,
org.apache.camel.LoggingLevel.class, value)); return true;
case "options":
target.getConfiguration().setOptions(property(camelContext,
java.util.Map.class, value)); return true;
case "passphrase":
target.getConfiguration().setPassphrase(property(camelContext,
java.lang.String.class, value)); return true;
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted":
target.getConfiguration().setProducerPoolBlockWhenExhausted(property(camelContext,
boolean.class, value)); return true;
case "producerpoolenabled":
case "producerPoolEnabled":
target.getConfiguration().setProducerPoolEnabled(property(camelContext,
boolean.class, value)); return true;
case "producerpoolmaxidle":
case "producerPoolMaxIdle":
target.getConfiguration().setProducerPoolMaxIdle(property(camelContext,
int.class, value)); return true;
case "producerpoolmaxtotal":
case "producerPoolMaxTotal":
target.getConfiguration().setProducerPoolMaxTotal(property(camelContext,
int.class, value)); return true;
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait":
target.getConfiguration().setProducerPoolMaxWait(property(camelContext,
long.class, value)); return true;
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle":
target.getConfiguration().setProducerPoolMinEvictableIdle(property(camelContext,
long.class, value)); return true;
case "producerpoolminidle":
@@ -221,12 +225,16 @@ public class NettyEndpointConfigurer extends
PropertyConfigurerSupport implement
case "noReplyLogLevel": return org.apache.camel.LoggingLevel.class;
case "options": return java.util.Map.class;
case "passphrase": return java.lang.String.class;
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted": return boolean.class;
case "producerpoolenabled":
case "producerPoolEnabled": return boolean.class;
case "producerpoolmaxidle":
case "producerPoolMaxIdle": return int.class;
case "producerpoolmaxtotal":
case "producerPoolMaxTotal": return int.class;
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait": return long.class;
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle": return long.class;
case "producerpoolminidle":
@@ -357,12 +365,16 @@ public class NettyEndpointConfigurer extends
PropertyConfigurerSupport implement
case "noReplyLogLevel": return
target.getConfiguration().getNoReplyLogLevel();
case "options": return target.getConfiguration().getOptions();
case "passphrase": return target.getConfiguration().getPassphrase();
+ case "producerpoolblockwhenexhausted":
+ case "producerPoolBlockWhenExhausted": return
target.getConfiguration().isProducerPoolBlockWhenExhausted();
case "producerpoolenabled":
case "producerPoolEnabled": return
target.getConfiguration().isProducerPoolEnabled();
case "producerpoolmaxidle":
case "producerPoolMaxIdle": return
target.getConfiguration().getProducerPoolMaxIdle();
case "producerpoolmaxtotal":
case "producerPoolMaxTotal": return
target.getConfiguration().getProducerPoolMaxTotal();
+ case "producerpoolmaxwait":
+ case "producerPoolMaxWait": return
target.getConfiguration().getProducerPoolMaxWait();
case "producerpoolminevictableidle":
case "producerPoolMinEvictableIdle": return
target.getConfiguration().getProducerPoolMinEvictableIdle();
case "producerpoolminidle":
diff --git
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointUriFactory.java
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointUriFactory.java
index 56bc66d62a8..e0b4999b9cc 100644
---
a/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointUriFactory.java
+++
b/components/camel-netty/src/generated/java/org/apache/camel/component/netty/NettyEndpointUriFactory.java
@@ -20,7 +20,7 @@ public class NettyEndpointUriFactory extends
org.apache.camel.support.component.
private static final Set<String> PROPERTY_NAMES;
private static final Set<String> SECRET_PROPERTY_NAMES;
static {
- Set<String> props = new HashSet<>(74);
+ Set<String> props = new HashSet<>(76);
props.add("usingExecutorService");
props.add("disconnect");
props.add("enabledProtocols");
@@ -38,6 +38,7 @@ public class NettyEndpointUriFactory extends
org.apache.camel.support.component.
props.add("connectTimeout");
props.add("options");
props.add("textline");
+ props.add("producerPoolBlockWhenExhausted");
props.add("workerGroup");
props.add("producerPoolMinEvictableIdle");
props.add("tcpNoDelay");
@@ -71,6 +72,7 @@ public class NettyEndpointUriFactory extends
org.apache.camel.support.component.
props.add("useByteBuf");
props.add("sslContextParameters");
props.add("correlationManager");
+ props.add("producerPoolMaxWait");
props.add("keyStoreResource");
props.add("autoAppendDelimiter");
props.add("reuseChannel");
diff --git
a/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
b/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
index c53e22d6a36..0f84110e0ac 100644
---
a/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
+++
b/components/camel-netty/src/generated/resources/org/apache/camel/component/netty/netty.json
@@ -53,9 +53,11 @@
"clientInitializerFactory": { "kind": "property", "displayName": "Client
Initializer Factory", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.netty.ClientInitializerFactory", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a custom ClientInitializ [...]
"correlationManager": { "kind": "property", "displayName": "Correlation
Manager", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.netty.NettyCamelStateCorrelationManager",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a custom correlation manager [...]
"lazyChannelCreation": { "kind": "property", "displayName": "Lazy Channel
Creation", "group": "producer (advanced)", "label": "producer,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": "Channels can be lazily
created to avoid exceptions, if the remote se [...]
+ "producerPoolBlockWhenExhausted": { "kind": "property", "displayName":
"Producer Pool Block When Exhausted", "group": "producer (advanced)", "label":
"producer,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": "Sets the value for the blockWhenExhausted co
[...]
"producerPoolEnabled": { "kind": "property", "displayName": "Producer Pool
Enabled", "group": "producer (advanced)", "label": "producer,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": "Whether producer pool is
enabled or not. Important: If you turn this [...]
"producerPoolMaxIdle": { "kind": "property", "displayName": "Producer Pool
Max Idle", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the cap on the number of idle instances
in the pool." },
"producerPoolMaxTotal": { "kind": "property", "displayName": "Producer
Pool Max Total", "group": "producer (advanced)", "label": "producer,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": "Sets the cap on the number of objects that can
be allocated by the pool [...]
+ "producerPoolMaxWait": { "kind": "property", "displayName": "Producer Pool
Max Wait", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": -1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the maximum duration (value in millis)
the borrowObject() method sh [...]
"producerPoolMinEvictableIdle": { "kind": "property", "displayName":
"Producer Pool Min Evictable Idle", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "integer", "javaType": "long",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
300000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the minimum amount of time (value in
millis) [...]
"producerPoolMinIdle": { "kind": "property", "displayName": "Producer Pool
Min Idle", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the minimum number of instances allowed
in the producer pool before the evictor thread ( [...]
"udpConnectionlessSending": { "kind": "property", "displayName": "Udp
Connectionless Sending", "group": "producer (advanced)", "label":
"producer,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": "This option supports connection less udp
sending which is [...]
@@ -130,9 +132,11 @@
"clientInitializerFactory": { "kind": "parameter", "displayName": "Client
Initializer Factory", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.netty.ClientInitializerFactory", "deprecated":
false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a custom ClientInitiali [...]
"correlationManager": { "kind": "parameter", "displayName": "Correlation
Manager", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.netty.NettyCamelStateCorrelationManager",
"deprecated": false, "autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "To use a custom correlation manage [...]
"lazyChannelCreation": { "kind": "parameter", "displayName": "Lazy Channel
Creation", "group": "producer (advanced)", "label": "producer,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": "Channels can be lazily
created to avoid exceptions, if the remote s [...]
+ "producerPoolBlockWhenExhausted": { "kind": "parameter", "displayName":
"Producer Pool Block When Exhausted", "group": "producer (advanced)", "label":
"producer,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": "Sets the value for the blockWhenExhausted c
[...]
"producerPoolEnabled": { "kind": "parameter", "displayName": "Producer
Pool Enabled", "group": "producer (advanced)", "label": "producer,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": "Whether producer pool is
enabled or not. Important: If you turn thi [...]
"producerPoolMaxIdle": { "kind": "parameter", "displayName": "Producer
Pool Max Idle", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": 100, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the cap on the number of idle instances
in the pool." },
"producerPoolMaxTotal": { "kind": "parameter", "displayName": "Producer
Pool Max Total", "group": "producer (advanced)", "label": "producer,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": "Sets the cap on the number of objects that can
be allocated by the poo [...]
+ "producerPoolMaxWait": { "kind": "parameter", "displayName": "Producer
Pool Max Wait", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": -1, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the maximum duration (value in millis)
the borrowObject() method s [...]
"producerPoolMinEvictableIdle": { "kind": "parameter", "displayName":
"Producer Pool Min Evictable Idle", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "integer", "javaType": "long",
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
300000, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the minimum amount of time (value in
millis [...]
"producerPoolMinIdle": { "kind": "parameter", "displayName": "Producer
Pool Min Idle", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "integer", "javaType": "int", "deprecated": false,
"autowired": false, "secret": false, "configurationClass":
"org.apache.camel.component.netty.NettyConfiguration", "configurationField":
"configuration", "description": "Sets the minimum number of instances allowed
in the producer pool before the evictor thread [...]
"udpConnectionlessSending": { "kind": "parameter", "displayName": "Udp
Connectionless Sending", "group": "producer (advanced)", "label":
"producer,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": "This option supports connection less udp
sending which i [...]
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 ca0f25b3c57..55959abae25 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
@@ -104,6 +104,10 @@ public class NettyConfiguration extends
NettyServerBootstrapConfiguration implem
private int producerPoolMaxIdle = 100;
@UriParam(label = "producer,advanced", defaultValue = "" + 5 * 60 * 1000L)
private long producerPoolMinEvictableIdle = 5 * 60 * 1000L;
+ @UriParam(label = "producer,advanced", defaultValue = "-1")
+ private long producerPoolMaxWait = -1;
+ @UriParam(label = "producer,advanced", defaultValue = "true")
+ private boolean producerPoolBlockWhenExhausted = true;
@UriParam(label = "producer,advanced", defaultValue = "true")
private boolean producerPoolEnabled = true;
@UriParam(label = "producer,advanced")
@@ -662,6 +666,32 @@ public class NettyConfiguration extends
NettyServerBootstrapConfiguration implem
this.producerPoolMinEvictableIdle = producerPoolMinEvictableIdle;
}
+ public long getProducerPoolMaxWait() {
+ return producerPoolMaxWait;
+ }
+
+ /**
+ * Sets the maximum duration (value in millis) the borrowObject() method
should block before throwing an exception
+ * when the pool is exhausted and producerPoolBlockWhenExhausted is true.
When less than 0, the borrowObject()
+ * method may block indefinitely.
+ */
+ public void setProducerPoolMaxWait(long producerPoolMaxWait) {
+ this.producerPoolMaxWait = producerPoolMaxWait;
+ }
+
+ public boolean isProducerPoolBlockWhenExhausted() {
+ return producerPoolBlockWhenExhausted;
+ }
+
+ /**
+ * Sets the value for the blockWhenExhausted configuration attribute. It
determines whether to block when the
+ * borrowObject() method is invoked when the pool is exhausted (the
maximum number of "active" objects has been
+ * reached).
+ */
+ public void setProducerPoolBlockWhenExhausted(boolean
producerPoolBlockWhenExhausted) {
+ this.producerPoolBlockWhenExhausted = producerPoolBlockWhenExhausted;
+ }
+
public boolean isProducerPoolEnabled() {
return producerPoolEnabled;
}
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 8b96ef3e27f..4dc959bfa8e 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
@@ -112,6 +112,8 @@ public class NettyProducer extends DefaultAsyncProducer {
config.setMaxTotal(configuration.getProducerPoolMaxTotal());
config.setMinIdle(configuration.getProducerPoolMinIdle());
config.setMaxIdle(configuration.getProducerPoolMaxIdle());
+
config.setBlockWhenExhausted(configuration.isProducerPoolBlockWhenExhausted());
+
config.setMaxWait(Duration.ofMillis(configuration.getProducerPoolMaxWait()));
// we should test on borrow to ensure the channel is still valid
config.setTestOnBorrow(true);
// idle channels can be evicted
@@ -550,7 +552,7 @@ public class NettyProducer extends DefaultAsyncProducer {
LOG.trace("Putting channel back to pool {}", channel);
pool.returnObject(channelFuture);
} else {
- // and if its not active then invalidate it
+ // and if it's not active then invalidate it
LOG.trace("Invalidating channel from pool {}", channel);
pool.invalidateObject(channelFuture);
}