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 017645e364c45..cfb56bdf38f6e 100644 --- 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 @@ -119,9 +119,15 @@ protected void doStart() throws Exception { // 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; + } } }