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
##########
File path: components/camel-slack/pom.xml
##########
@@ -62,6 +62,10 @@
<groupId>org.apache.httpcomponents</groupId>
Review comment:
Can the old client be removed?
##########
File path:
components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackProducer.java
##########
@@ -59,7 +61,7 @@ protected void doStop() throws Exception {
}
Review comment:
And you have a doStop method where you stop/close the client?
----------------------------------------------------------------
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:
[email protected]