You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/07/26 14:17:02 UTC

[camel] branch CAMEL-19650/4.0 created (now 786480fd199)

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a change to branch CAMEL-19650/4.0
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 786480fd199 CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration (#10827)

This branch includes the following new commits:

     new 786480fd199 CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration (#10827)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/01: CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration (#10827)

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-19650/4.0
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 786480fd199e53da457210b3e19153a0c38138d1
Author: Kartik  kalaghatgi <ka...@gmail.com>
AuthorDate: Wed Jul 26 19:35:10 2023 +0530

    CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration (#10827)
    
    * CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration
    
    Camel kafka component when provided with custom worker pool is ignored and still creates a new pool, this is fixed with check added to use custom worker pool if provided.
    
    * CAMEL-19650: Camel Kafka doesn't honor 'workerPool' configuration
    
    Fixing checkstyle issue
---
 .../java/org/apache/camel/component/kafka/KafkaProducer.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
index 2f507d3b9fd..19803e2a3ad 100755
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaProducer.java
@@ -169,9 +169,15 @@ public class KafkaProducer extends DefaultAsyncProducer {
 
         // if we are in asynchronous mode we need a worker pool
         if (!configuration.isSynchronous() && workerPool == null) {
-            workerPool = endpoint.createProducerExecutor();
-            // we create a thread pool so we should also shut it down
-            shutdownWorkerPool = true;
+            // If custom worker pool is provided, then use it, else create a new one.
+            if (configuration.getWorkerPool() != null) {
+                workerPool = configuration.getWorkerPool();
+                shutdownWorkerPool = false;
+            } else {
+                workerPool = endpoint.createProducerExecutor();
+                // we create a thread pool so we should also shut it down
+                shutdownWorkerPool = true;
+            }
         }
 
         // init client id which we may need to get from the kafka producer via reflection