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-spring-boot.git


The following commit(s) were added to refs/heads/main by this push:
     new 3df0c455a37 CAMEL-18871 - Application does not recover (threads are 
WAITING) when NettyProducer pool is exhausted (#697)
3df0c455a37 is described below

commit 3df0c455a37c3681fcb5c9285edecc888ef7997a
Author: Vincenzo Galluccio <66736363+vinceg...@users.noreply.github.com>
AuthorDate: Sat Jan 14 08:21:26 2023 +0100

    CAMEL-18871 - Application does not recover (threads are WAITING) when 
NettyProducer pool is exhausted (#697)
    
    * CAMEL-18871 - camel-netty-starter - Add new params
    
    * CAMEL-18871 - camel-netty-starter - Add new params
    
    * CAMEL-18871 - camel-netty-starter - Add new params
---
 .../camel/springboot/catalog/components/netty.json |  4 +++
 .../camel-netty-starter/src/main/docs/netty.json   | 16 ++++++++++-
 .../springboot/NettyComponentConfiguration.java    | 32 +++++++++++++++++++++-
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/netty.json
 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/netty.json
index 907f273fc37..063e211a943 100644
--- 
a/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/netty.json
+++ 
b/catalog/camel-catalog-provider-springboot/src/main/resources/org/apache/camel/springboot/catalog/components/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-starter/camel-netty-starter/src/main/docs/netty.json 
b/components-starter/camel-netty-starter/src/main/docs/netty.json
index 5f4950cc5ec..278ee0e622d 100644
--- a/components-starter/camel-netty-starter/src/main/docs/netty.json
+++ b/components-starter/camel-netty-starter/src/main/docs/netty.json
@@ -277,6 +277,13 @@
       "description": "Password setting to use in order to encrypt\/decrypt 
payloads sent using SSH",
       "sourceType": 
"org.apache.camel.component.netty.springboot.NettyComponentConfiguration"
     },
+    {
+      "name": "camel.component.netty.producer-pool-block-when-exhausted",
+      "type": "java.lang.Boolean",
+      "description": "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).",
+      "sourceType": 
"org.apache.camel.component.netty.springboot.NettyComponentConfiguration",
+      "defaultValue": true
+    },
     {
       "name": "camel.component.netty.producer-pool-enabled",
       "type": "java.lang.Boolean",
@@ -298,6 +305,13 @@
       "sourceType": 
"org.apache.camel.component.netty.springboot.NettyComponentConfiguration",
       "defaultValue": -1
     },
+    {
+      "name": "camel.component.netty.producer-pool-max-wait",
+      "type": "java.lang.Long",
+      "description": "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.",
+      "sourceType": 
"org.apache.camel.component.netty.springboot.NettyComponentConfiguration",
+      "defaultValue": -1
+    },
     {
       "name": "camel.component.netty.producer-pool-min-evictable-idle",
       "type": "java.lang.Long",
@@ -504,4 +518,4 @@
     }
   ],
   "hints": []
-}
\ No newline at end of file
+}
diff --git 
a/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
 
b/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
index daf4fb28a47..6515e972f22 100644
--- 
a/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
+++ 
b/components-starter/camel-netty-starter/src/main/java/org/apache/camel/component/netty/springboot/NettyComponentConfiguration.java
@@ -245,6 +245,13 @@ public class NettyComponentConfiguration
      * is not up and running when the Camel producer is started.
      */
     private Boolean lazyChannelCreation = true;
+    /**
+     * 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).
+     */
+    private Boolean producerPoolBlockWhenExhausted = true;
     /**
      * Whether producer pool is enabled or not. Important: If you turn this off
      * then a single shared connection is used for the producer, also if you 
are
@@ -268,6 +275,13 @@ public class NettyComponentConfiguration
      * a negative value for no limit.
      */
     private Integer producerPoolMaxTotal = -1;
+    /**
+     * 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.
+     */
+    private Long producerPoolMaxWait = -1;
     /**
      * Sets the minimum amount of time (value in millis) an object may sit idle
      * in the pool before it is eligible for eviction by the idle object
@@ -739,6 +753,14 @@ public class NettyComponentConfiguration
         this.lazyChannelCreation = lazyChannelCreation;
     }
 
+    public Boolean getProducerPoolBlockWhenExhausted() {
+        return producerPoolBlockWhenExhausted;
+    }
+
+    public void setProducerPoolBlockWhenExhausted(Boolean 
producerPoolBlockWhenExhausted) {
+        this.producerPoolBlockWhenExhausted = producerPoolBlockWhenExhausted;
+    }
+
     public Boolean getProducerPoolEnabled() {
         return producerPoolEnabled;
     }
@@ -763,6 +785,14 @@ public class NettyComponentConfiguration
         this.producerPoolMaxTotal = producerPoolMaxTotal;
     }
 
+    public Long getProducerPoolMaxWait() {
+        return producerPoolMaxWait;
+    }
+
+    public void setProducerPoolMaxWait(Long producerPoolMaxWait) {
+        this.producerPoolMaxWait = producerPoolMaxWait;
+    }
+
     public Long getProducerPoolMinEvictableIdle() {
         return producerPoolMinEvictableIdle;
     }
@@ -1077,4 +1107,4 @@ public class NettyComponentConfiguration
             Boolean useGlobalSslContextParameters) {
         this.useGlobalSslContextParameters = useGlobalSslContextParameters;
     }
-}
\ No newline at end of file
+}

Reply via email to