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 a6e9cd796d8 CAMEL-18871 - camel-netty - Add 
producerPoolBlockWhenExhausted & producerPoolMaxWait options (#9047)
a6e9cd796d8 is described below

commit a6e9cd796d817ece4a140c1f58ef4d0ccde1bcc5
Author: VinceGall <66736363+vinceg...@users.noreply.github.com>
AuthorDate: Thu Jan 12 07:25:56 2023 +0100

    CAMEL-18871 - camel-netty - Add producerPoolBlockWhenExhausted & 
producerPoolMaxWait options (#9047)
    
    Co-authored-by: Vincenzo Galluccio <vincenzo.galluc...@ing.com>
---
 .../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 baf1b82afa7..55c24a8e337 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
@@ -21,7 +21,7 @@ public class NettyEndpointUriFactory extends 
org.apache.camel.support.component.
     private static final Set<String> SECRET_PROPERTY_NAMES;
     private static final Set<String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(74);
+        Set<String> props = new HashSet<>(76);
         props.add("allowDefaultCodec");
         props.add("allowSerializedHeaders");
         props.add("autoAppendDelimiter");
@@ -61,9 +61,11 @@ public class NettyEndpointUriFactory extends 
org.apache.camel.support.component.
         props.add("options");
         props.add("passphrase");
         props.add("port");
+        props.add("producerPoolBlockWhenExhausted");
         props.add("producerPoolEnabled");
         props.add("producerPoolMaxIdle");
         props.add("producerPoolMaxTotal");
+        props.add("producerPoolMaxWait");
         props.add("producerPoolMinEvictableIdle");
         props.add("producerPoolMinIdle");
         props.add("protocol");
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 893b3d10bc3..a7d3015a602 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 [...]
@@ -143,9 +145,11 @@
     "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 [...]
     "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start 
Producer", "group": "producer (advanced)", "label": "producer,advanced", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": false, 
"description": "Whether the producer should be started lazy (on the first 
message). By starting lazy you can use this to allow CamelContext and routes to 
startup in situations where a producer may other [...]
+    "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 823fca69a6c..19a98838e60 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
@@ -103,6 +103,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")
@@ -661,6 +665,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 1e1bc08f667..0683f07ad17 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
@@ -111,6 +111,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
@@ -549,7 +551,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);
             }

Reply via email to