davsclaus commented on a change in pull request #5034:
URL: https://github.com/apache/camel/pull/5034#discussion_r571633043



##########
File path: 
components/camel-nats/src/main/java/org/apache/camel/component/nats/NatsProducer.java
##########
@@ -17,19 +17,29 @@
 package org.apache.camel.component.nats;
 
 import java.time.Duration;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
 
 import io.nats.client.Connection;
 import io.nats.client.Connection.Status;
+import io.nats.client.Message;
+import org.apache.camel.AsyncCallback;
 import org.apache.camel.Exchange;
-import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.ExchangeTimedOutException;
+import org.apache.camel.InvalidPayloadException;
+import org.apache.camel.support.DefaultAsyncProducer;
 import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class NatsProducer extends DefaultProducer {
+public class NatsProducer extends DefaultAsyncProducer {
 
     private static final Logger LOG = 
LoggerFactory.getLogger(NatsProducer.class);
 
+    private final ScheduledExecutorService scheduler = 
Executors.newScheduledThreadPool(1);

Review comment:
       Also we could consider having a shared thread pool on the component 
level, as otherwise this is a private pool per producer, so that can mean if 
you have many producers you have many idle thread pools.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to