You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/02/02 05:16:33 UTC

[GitHub] [camel] davsclaus commented on a change in pull request #4990: Slack: Re-use http client and consume response

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



##########
File path: components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
##########
@@ -32,21 +32,23 @@
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
 
 public class SlackProducer extends DefaultProducer {
 
-    private SlackEndpoint slackEndpoint;
+    private final SlackEndpoint slackEndpoint;
+    private final HttpClient client;
 
     public SlackProducer(SlackEndpoint endpoint) {
         super(endpoint);
         this.slackEndpoint = endpoint;
+        this.client = HttpClientBuilder.create().useSystemProperties().build();

Review comment:
       Same as consumer

##########
File path: components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java
##########
@@ -48,10 +48,12 @@
     private SlackEndpoint slackEndpoint;
     private String timestamp;
     private String channelId;
+    private HttpClient client;
 
     public SlackConsumer(SlackEndpoint endpoint, Processor processor) throws IOException, DeserializationException {
         super(endpoint, processor);
         this.slackEndpoint = endpoint;
+        this.client = HttpClientBuilder.create().useSystemProperties().build();

Review comment:
       Do not create the client in the constructor, but in doStart




----------------------------------------------------------------
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:
users@infra.apache.org