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 2022/05/27 10:18:53 UTC

[GitHub] [camel] Croway opened a new pull request, #7683: ✨ camel-whatsapp component

Croway opened a new pull request, #7683:
URL: https://github.com/apache/camel/pull/7683

   - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   
   Hello, since WhatsApp business released new public API, https://developers.facebook.com/docs/whatsapp/cloud-api/, I created a new component camel-whatsapp which integrate camel with those API (pretty much like telegram).
   
   As you can see from the integration test, the producer is working as expected, but before adding more features, documentation and so on I'd like to have your feedback if it is worth to have this component.
   
   Moreover I have some question:
   - I'm using async-http-client as HTTP client, but seems like that the project is not maintained anymore, should I use another library?
   - As you can see from cloud-api documentation, webhook can be used, I was wondering if camel-webhook can be used and if I could receive some help
   
   The output of the test right now is:
   
   ![image](https://user-images.githubusercontent.com/34543311/170681072-e2c96b5c-d2f3-4601-b1ab-d806ebb07f5c.png)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884126301


##########
components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppApiConfig.java:
##########
@@ -0,0 +1,72 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.camel.component.whatsapp;
+
+public class WhatsAppApiConfig {
+
+	private final String authorizationToken;
+	private final int port;
+	private final String baseUri;
+	private final String phoneNumberId;
+	private final String apiVersion;
+	private final String recipientPhoneNumber;
+
+	public WhatsAppApiConfig(String baseUri, int port, String authorizationToken, String phoneNumberId, String apiVersion, String recipientPhoneNumber) {
+		this.baseUri = baseUri;
+		this.port = port;
+		this.authorizationToken = authorizationToken;
+		this.phoneNumberId = phoneNumberId;
+		this.apiVersion = apiVersion;
+		this.recipientPhoneNumber = recipientPhoneNumber;
+	}
+
+	public static WhatsAppApiConfig fromEnv() {
+		final String authorizationToken = System.getenv("WHATSAPP_AUTHORIZATION_TOKEN");
+		final String phoneNumberId = System.getenv("WHATSAPP_PHONE_NUMBER_ID");
+		final String recipientPhoneNumber = System.getenv("WHATSAPP_RECIPIENT_PHONE_NUMBER");
+		return new WhatsAppApiConfig(WhatsAppComponent.API_DEFAULT_URL, 443, authorizationToken, phoneNumberId, WhatsAppComponent.API_DEFAULT_VERSION, recipientPhoneNumber);

Review Comment:
   I'm using 443 here because this method is used for real integration tests against `https://graph.facebook.com` I will create another configuration that will be used for mocked test with `AvailablePortFinder`, thank you for the hint!



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] davsclaus commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
davsclaus commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1159376161

   Whats the status of this PR. Is it good to be merged?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1167169417

   There are too many components to be tested in this PR, components were removed or the code needs a rebase: (242 likely to be tested)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141314405

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141316124

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1140887475

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152256835

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **3 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884126481


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -0,0 +1,285 @@
+package org.apache.camel.component.whatsapp.service;
+
+import static org.asynchttpclient.util.HttpUtils.extractContentTypeCharsetAttribute;
+import static org.asynchttpclient.util.MiscUtils.withDefault;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.support.GZIPHelper;
+import org.apache.camel.util.IOHelper;
+
+import org.asynchttpclient.AsyncHandler;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.HttpResponseBodyPart;
+import org.asynchttpclient.HttpResponseStatus;
+import org.asynchttpclient.RequestBuilder;
+import org.asynchttpclient.request.body.multipart.ByteArrayPart;
+import org.asynchttpclient.request.body.multipart.FilePart;
+import org.asynchttpclient.request.body.multipart.MultipartUtils;
+import org.asynchttpclient.request.body.multipart.StringPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.netty.handler.codec.http.HttpHeaders;
+
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+	private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+	private final AsyncHttpClient asyncHttpClient;
+	private final ObjectMapper mapper;
+	private final String baseUri;
+	private final String authorizationToken;
+
+	public WhatsAppServiceRestAPIAdapter(AsyncHttpClient client, String baseUri, String apiVersion, String phoneNumberId, String authorizationToken) {
+		this.asyncHttpClient = client;
+		this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+		this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+		this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+		this.authorizationToken = authorizationToken;
+
+		int bufferSize = 4 * 1024;

Review Comment:
   I don't think so, I removed it, moreover I'll try to use java11 http client in order to implement this service



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141323194

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152595583

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **5 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] orpiske commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
orpiske commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r883696299


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -0,0 +1,285 @@
+package org.apache.camel.component.whatsapp.service;
+
+import static org.asynchttpclient.util.HttpUtils.extractContentTypeCharsetAttribute;
+import static org.asynchttpclient.util.MiscUtils.withDefault;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.support.GZIPHelper;
+import org.apache.camel.util.IOHelper;
+
+import org.asynchttpclient.AsyncHandler;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.HttpResponseBodyPart;
+import org.asynchttpclient.HttpResponseStatus;
+import org.asynchttpclient.RequestBuilder;
+import org.asynchttpclient.request.body.multipart.ByteArrayPart;
+import org.asynchttpclient.request.body.multipart.FilePart;
+import org.asynchttpclient.request.body.multipart.MultipartUtils;
+import org.asynchttpclient.request.body.multipart.StringPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.netty.handler.codec.http.HttpHeaders;
+
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+	private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+	private final AsyncHttpClient asyncHttpClient;
+	private final ObjectMapper mapper;
+	private final String baseUri;
+	private final String authorizationToken;
+
+	public WhatsAppServiceRestAPIAdapter(AsyncHttpClient client, String baseUri, String apiVersion, String phoneNumberId, String authorizationToken) {
+		this.asyncHttpClient = client;
+		this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+		this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+		this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+		this.authorizationToken = authorizationToken;
+
+		int bufferSize = 4 * 1024;
+
+		final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> m = new HashMap<>();
+		m.put(TextMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));

Review Comment:
   Maybe use a constant for the `/messages` endpoint? 



##########
components/camel-whatsapp/src/test/java/org/apache/camel/component/whatsapp/WhatsAppApiConfig.java:
##########
@@ -0,0 +1,72 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.camel.component.whatsapp;
+
+public class WhatsAppApiConfig {
+
+	private final String authorizationToken;
+	private final int port;
+	private final String baseUri;
+	private final String phoneNumberId;
+	private final String apiVersion;
+	private final String recipientPhoneNumber;
+
+	public WhatsAppApiConfig(String baseUri, int port, String authorizationToken, String phoneNumberId, String apiVersion, String recipientPhoneNumber) {
+		this.baseUri = baseUri;
+		this.port = port;
+		this.authorizationToken = authorizationToken;
+		this.phoneNumberId = phoneNumberId;
+		this.apiVersion = apiVersion;
+		this.recipientPhoneNumber = recipientPhoneNumber;
+	}
+
+	public static WhatsAppApiConfig fromEnv() {
+		final String authorizationToken = System.getenv("WHATSAPP_AUTHORIZATION_TOKEN");
+		final String phoneNumberId = System.getenv("WHATSAPP_PHONE_NUMBER_ID");
+		final String recipientPhoneNumber = System.getenv("WHATSAPP_RECIPIENT_PHONE_NUMBER");
+		return new WhatsAppApiConfig(WhatsAppComponent.API_DEFAULT_URL, 443, authorizationToken, phoneNumberId, WhatsAppComponent.API_DEFAULT_VERSION, recipientPhoneNumber);

Review Comment:
   If possible, try not to use a fixed port as it breaks the tests on some CIs if the port is used (and, also, 443 is a privileged port that would require root access). Take a look at the `AvailablePortFinder` class for this.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java:
##########
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WhatsAppProducer extends DefaultAsyncProducer {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppProducer.class);
+
+	private WhatsAppEndpoint endpoint;
+
+	public WhatsAppProducer(WhatsAppEndpoint endpoint) {
+		super(endpoint);
+		this.endpoint = endpoint;
+	}
+
+	@Override
+	public boolean process(Exchange exchange, AsyncCallback callback) {
+		if (exchange.getIn().getBody() == null) {
+			// fail fast
+			LOG.debug("Received exchange with empty body, skipping");
+			callback.done(true);
+			return true;
+		}
+
+		WhatsAppConfiguration config = endpoint.getConfiguration();
+
+		// Tries to get a message in its OutgoingMessage format
+		// Automatic conversion applies here
+		BaseMessage message = exchange.getIn().getBody(BaseMessage.class);
+		if (message == null) {
+			throw new IllegalArgumentException("Cannot convert the content to a WhatsApp MessageRequest");
+		}

Review Comment:
   I think you can use `ObjectHelper.notNull` here. 



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java:
##########
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WhatsAppProducer extends DefaultAsyncProducer {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppProducer.class);
+
+	private WhatsAppEndpoint endpoint;
+
+	public WhatsAppProducer(WhatsAppEndpoint endpoint) {
+		super(endpoint);
+		this.endpoint = endpoint;
+	}
+
+	@Override
+	public boolean process(Exchange exchange, AsyncCallback callback) {
+		if (exchange.getIn().getBody() == null) {
+			// fail fast
+			LOG.debug("Received exchange with empty body, skipping");
+			callback.done(true);
+			return true;
+		}
+
+		WhatsAppConfiguration config = endpoint.getConfiguration();
+
+		// Tries to get a message in its OutgoingMessage format
+		// Automatic conversion applies here
+		BaseMessage message = exchange.getIn().getBody(BaseMessage.class);
+		if (message == null) {
+			throw new IllegalArgumentException("Cannot convert the content to a WhatsApp MessageRequest");
+		}
+
+		final WhatsAppService service = endpoint.getWhatsappService();
+
+		LOG.debug("Message being sent is: {}", message);
+		LOG.debug("Headers of message being sent are: {}", exchange.getIn().getHeaders());
+
+		service.sendMessage(exchange, callback, message);

Review Comment:
   Is there a change of `service` being `null` here? It does not look like the case, so ... just double checking.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -0,0 +1,285 @@
+package org.apache.camel.component.whatsapp.service;
+
+import static org.asynchttpclient.util.HttpUtils.extractContentTypeCharsetAttribute;
+import static org.asynchttpclient.util.MiscUtils.withDefault;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.support.GZIPHelper;
+import org.apache.camel.util.IOHelper;
+
+import org.asynchttpclient.AsyncHandler;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.HttpResponseBodyPart;
+import org.asynchttpclient.HttpResponseStatus;
+import org.asynchttpclient.RequestBuilder;
+import org.asynchttpclient.request.body.multipart.ByteArrayPart;
+import org.asynchttpclient.request.body.multipart.FilePart;
+import org.asynchttpclient.request.body.multipart.MultipartUtils;
+import org.asynchttpclient.request.body.multipart.StringPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.netty.handler.codec.http.HttpHeaders;
+
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+	private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+	private final AsyncHttpClient asyncHttpClient;
+	private final ObjectMapper mapper;
+	private final String baseUri;
+	private final String authorizationToken;
+
+	public WhatsAppServiceRestAPIAdapter(AsyncHttpClient client, String baseUri, String apiVersion, String phoneNumberId, String authorizationToken) {
+		this.asyncHttpClient = client;
+		this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+		this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+		this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+		this.authorizationToken = authorizationToken;
+
+		int bufferSize = 4 * 1024;
+
+		final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> m = new HashMap<>();
+		m.put(TextMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(MediaMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(LocationMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(ContactMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(InteractiveMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(UploadMediaRequest.class, new OutgoingMediaMessageHandler(client, bufferSize, mapper, this.baseUri + "/media"));
+
+		this.handlers = m;
+	}
+
+	@Override
+	public void sendMessage(Exchange exchange, AsyncCallback callback, BaseMessage message) {
+		final WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage> handler =
+				(WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage>) handlers.get(message.getClass());
+		if (handler == null) {
+			throw new IllegalArgumentException(
+					"Unsupported message type " + (message.getClass().getName()));
+		}

Review Comment:
   You can use `ObjectHelper.notNull` here.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -0,0 +1,285 @@
+package org.apache.camel.component.whatsapp.service;
+
+import static org.asynchttpclient.util.HttpUtils.extractContentTypeCharsetAttribute;
+import static org.asynchttpclient.util.MiscUtils.withDefault;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.support.GZIPHelper;
+import org.apache.camel.util.IOHelper;
+
+import org.asynchttpclient.AsyncHandler;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.HttpResponseBodyPart;
+import org.asynchttpclient.HttpResponseStatus;
+import org.asynchttpclient.RequestBuilder;
+import org.asynchttpclient.request.body.multipart.ByteArrayPart;
+import org.asynchttpclient.request.body.multipart.FilePart;
+import org.asynchttpclient.request.body.multipart.MultipartUtils;
+import org.asynchttpclient.request.body.multipart.StringPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.netty.handler.codec.http.HttpHeaders;
+
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+	private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+	private final AsyncHttpClient asyncHttpClient;
+	private final ObjectMapper mapper;
+	private final String baseUri;
+	private final String authorizationToken;
+
+	public WhatsAppServiceRestAPIAdapter(AsyncHttpClient client, String baseUri, String apiVersion, String phoneNumberId, String authorizationToken) {
+		this.asyncHttpClient = client;
+		this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+		this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+		this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+		this.authorizationToken = authorizationToken;
+
+		int bufferSize = 4 * 1024;
+
+		final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> m = new HashMap<>();
+		m.put(TextMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(MediaMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(LocationMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(ContactMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(InteractiveMessageRequest.class, new OutgoingPlainMessageHandler(client, bufferSize, mapper, this.baseUri + "/messages"));
+		m.put(UploadMediaRequest.class, new OutgoingMediaMessageHandler(client, bufferSize, mapper, this.baseUri + "/media"));
+
+		this.handlers = m;
+	}
+
+	@Override
+	public void sendMessage(Exchange exchange, AsyncCallback callback, BaseMessage message) {
+		final WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage> handler =
+				(WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage>) handlers.get(message.getClass());
+		if (handler == null) {
+			throw new IllegalArgumentException(
+					"Unsupported message type " + (message.getClass().getName()));
+		}
+		handler.sendMessage(exchange, callback, message, authorizationToken);
+	}
+
+	static class OutgoingMediaMessageHandler extends WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<UploadMediaRequest> {
+
+		public OutgoingMediaMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper,
+				String uri, Class<? extends MessageResponse> returnType) {
+			super(asyncHttpClient, bufferSize, mapper, uri, "multipart/form-data", returnType);
+		}
+
+		public OutgoingMediaMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper,
+				String uri) {
+			this(asyncHttpClient, bufferSize, mapper, uri, MessageResponse.class);
+		}
+
+		@Override
+		protected void addBody(RequestBuilder builder, UploadMediaRequest message) {
+			FilePart filePart = new FilePart("file", message.getUploadMedia().getFile(), message.getUploadMedia().getContentType());
+			builder.setBodyParts(List.of(
+					filePart,
+					new StringPart("messaging_product", "whatsapp")
+			));
+		}
+
+	}
+
+	static class OutgoingPlainMessageHandler extends WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<BaseMessage> {
+
+		public OutgoingPlainMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper,
+				String uri, Class<? extends MessageResponse> returnType) {
+			super(asyncHttpClient, bufferSize, mapper, uri, "application/json", returnType);
+		}
+
+		public OutgoingPlainMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper,
+				String uri) {
+			this(asyncHttpClient, bufferSize, mapper, uri, MessageResponse.class);
+		}
+
+		@Override
+		protected void addBody(RequestBuilder builder, BaseMessage message) {
+			try {
+				final String body = mapper.writeValueAsString(message);
+				builder.setBody(body);
+			} catch (JsonProcessingException e) {
+				throw new RuntimeCamelException("Could not serialize " + message, e);
+			}
+		}
+
+	}
+
+	abstract static class OutgoingMessageHandler<T extends BaseMessage> {
+		protected final ObjectMapper mapper;
+		private final AsyncHttpClient asyncHttpClient;
+		private final int bufferSize;
+		private final String contentType;
+		private final String uri;
+		private final Class<? extends MessageResponse> resultClass;
+
+		public OutgoingMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper, String uri,
+				String contentType, Class<? extends MessageResponse> resultClass) {
+			this.resultClass = resultClass;
+			this.asyncHttpClient = asyncHttpClient;
+			this.bufferSize = bufferSize;
+			this.mapper = mapper;
+			this.uri = uri;
+			this.contentType = contentType;
+		}
+
+		public void sendMessage(Exchange exchange, AsyncCallback callback, T message, String authorizationToken) {
+			final RequestBuilder builder = new RequestBuilder("POST")
+					.setUrl(uri);
+			if (contentType != null) {
+				builder.setHeader("Content-Type", contentType);
+			}
+			builder.setHeader("Authorization", "Bearer " + authorizationToken);
+			builder.setHeader("Accept", "application/json");

Review Comment:
   Header constants, if they are available in one of the libraries in use, can make the code easier to read/maintain.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIAdapter.java:
##########
@@ -0,0 +1,285 @@
+package org.apache.camel.component.whatsapp.service;
+
+import static org.asynchttpclient.util.HttpUtils.extractContentTypeCharsetAttribute;
+import static org.asynchttpclient.util.MiscUtils.withDefault;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.support.GZIPHelper;
+import org.apache.camel.util.IOHelper;
+
+import org.asynchttpclient.AsyncHandler;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.HttpResponseBodyPart;
+import org.asynchttpclient.HttpResponseStatus;
+import org.asynchttpclient.RequestBuilder;
+import org.asynchttpclient.request.body.multipart.ByteArrayPart;
+import org.asynchttpclient.request.body.multipart.FilePart;
+import org.asynchttpclient.request.body.multipart.MultipartUtils;
+import org.asynchttpclient.request.body.multipart.StringPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.netty.handler.codec.http.HttpHeaders;
+
+public class WhatsAppServiceRestAPIAdapter implements WhatsAppService {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIAdapter.class);
+
+	private final Map<Class<?>, WhatsAppServiceRestAPIAdapter.OutgoingMessageHandler<?>> handlers;
+	private final AsyncHttpClient asyncHttpClient;
+	private final ObjectMapper mapper;
+	private final String baseUri;
+	private final String authorizationToken;
+
+	public WhatsAppServiceRestAPIAdapter(AsyncHttpClient client, String baseUri, String apiVersion, String phoneNumberId, String authorizationToken) {
+		this.asyncHttpClient = client;
+		this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+		this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+		this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+		this.authorizationToken = authorizationToken;
+
+		int bufferSize = 4 * 1024;

Review Comment:
   Any particular reason for this specific buffer size?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] orpiske commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
orpiske commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141284937

   @Croway BTW, please let me know if you need the build/test logs. The access to them is restricted, but I can upload them here as needed.
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r894549093


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+import java.util.List;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.webhook.WebhookCapableEndpoint;
+import org.apache.camel.component.webhook.WebhookConfiguration;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send messages.
+ */
+@UriEndpoint(firstVersion = "3.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",
+             category = {
+                     Category.CLOUD, Category.API,
+                     Category.CHAT },
+             headersClass = WhatsAppConstants.class)
+public class WhatsAppEndpoint extends ScheduledPollEndpoint implements WebhookCapableEndpoint {
+    private static final Logger LOG = LoggerFactory.getLogger(WhatsAppEndpoint.class);
+
+    @UriParam
+    private WhatsAppConfiguration configuration;
+
+    @UriParam(label = "advanced", description = "HttpClient implementation")
+    private HttpClient httpClient;
+    @UriParam(label = "advanced", description = "WhatsApp service implementation")
+    private WhatsAppService whatsappService;
+
+    private WebhookConfiguration webhookConfiguration;
+
+    public WhatsAppEndpoint(String endpointUri, Component component, WhatsAppConfiguration configuration, HttpClient client) {
+        super(endpointUri, component);
+        this.configuration = configuration;
+        this.httpClient = client;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (httpClient == null) {
+            httpClient
+                    = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2).connectTimeout(Duration.ofSeconds(10)).build();
+        }
+        if (whatsappService == null) {
+            whatsappService = new WhatsAppServiceRestAPIAdapter(
+                    httpClient, configuration.getBaseUri(), configuration.getApiVersion(), configuration.getPhoneNumberId(),
+                    configuration.getAuthorizationToken());
+        }
+        LOG.debug("client {}" + httpClient);
+        LOG.debug("whatsappService {}" + whatsappService);

Review Comment:
   OMG, I'm bad..



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152232094

   There are too many components to be tested in this PR, components were removed or the code needs a rebase: (67 likely to be tested)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] oscerd commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
oscerd commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1181704561

   Thanks @Croway 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] oscerd merged pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
oscerd merged PR #7683:
URL: https://github.com/apache/camel/pull/7683


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] orpiske commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
orpiske commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884936943


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/service/WhatsAppServiceRestAPIJDKAdapter.java:
##########
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.service;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublisher;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpRequest.Builder;
+import java.net.http.HttpResponse;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.component.whatsapp.WhatsAppService;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.ContactMessageRequest;
+import org.apache.camel.component.whatsapp.model.InteractiveMessageRequest;
+import org.apache.camel.component.whatsapp.model.LocationMessageRequest;
+import org.apache.camel.component.whatsapp.model.MediaMessageRequest;
+import org.apache.camel.component.whatsapp.model.MessageResponse;
+import org.apache.camel.component.whatsapp.model.TemplateMessageRequest;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.component.whatsapp.model.UploadMedia;
+import org.apache.camel.component.whatsapp.model.UploadMediaRequest;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Java11 Http Client implementation
+ */
+public class WhatsAppServiceRestAPIJDKAdapter implements WhatsAppService {
+    private static final Logger LOG = LoggerFactory.getLogger(WhatsAppServiceRestAPIJDKAdapter.class);
+
+    private static final String MESSAGES_ENDPOINT = "/messages";
+    private static final String MEDIA_ENDPOINT = "/media";
+
+    private final Map<Class<?>, WhatsAppServiceRestAPIJDKAdapter.OutgoingMessageHandler<?>> handlers;
+    private final ObjectMapper mapper;
+    private final String baseUri;
+    private final String authorizationToken;
+
+    public WhatsAppServiceRestAPIJDKAdapter(HttpClient client, String baseUri, String apiVersion, String phoneNumberId,
+                                            String authorizationToken) {
+        this.baseUri = baseUri + "/" + apiVersion + "/" + phoneNumberId;
+        this.mapper = new ObjectMapper().registerModule(new JavaTimeModule());
+        this.mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+        this.authorizationToken = authorizationToken;
+
+        final Map<Class<?>, WhatsAppServiceRestAPIJDKAdapter.OutgoingMessageHandler<?>> m = new HashMap<>();
+        m.put(TextMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+        m.put(MediaMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+        m.put(LocationMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+        m.put(ContactMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+        m.put(InteractiveMessageRequest.class,
+                new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+        m.put(UploadMediaRequest.class, new OutgoingMediaMessageHandler(client, mapper, this.baseUri + MEDIA_ENDPOINT));
+        m.put(TemplateMessageRequest.class, new OutgoingPlainMessageHandler(client, mapper, this.baseUri + MESSAGES_ENDPOINT));
+
+        this.handlers = m;
+    }
+
+    @Override
+    public void sendMessage(Exchange exchange, AsyncCallback callback, BaseMessage message) {
+        @SuppressWarnings("unchecked")
+        final WhatsAppServiceRestAPIJDKAdapter.OutgoingMessageHandler<BaseMessage> handler
+                = (WhatsAppServiceRestAPIJDKAdapter.OutgoingMessageHandler<BaseMessage>) handlers
+                        .get(message.getClass());
+
+        ObjectHelper.notNull(handler, "handler");
+
+        try {
+            handler.sendMessage(exchange, callback, message, authorizationToken);
+        } catch (IOException | InterruptedException e) {
+            throw new RuntimeCamelException("Could not send message " + message, e);
+        }
+    }
+
+    static class OutgoingMediaMessageHandler
+            extends WhatsAppServiceRestAPIJDKAdapter.OutgoingMessageHandler<UploadMediaRequest> {
+
+        public OutgoingMediaMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri,
+                                           Class<? extends MessageResponse> resultClass) {
+            super(httpClient, mapper, uri, null, resultClass);
+        }
+
+        public OutgoingMediaMessageHandler(HttpClient httpClient, ObjectMapper mapper, String uri) {
+            this(httpClient, mapper, uri, MessageResponse.class);
+        }
+
+        @Override
+        protected void addBody(Builder builder, UploadMediaRequest message) {
+            Map<Object, Object> formData = new HashMap<>();
+            formData.put("messaging_product", "whatsapp");
+            formData.put("file", message.getUploadMedia());
+
+            String boundary = new BigInteger(256, new Random()).toString();
+            try {
+                builder.POST(ofMimeMultipartData(formData, boundary));
+            } catch (IOException e) {
+                throw new RuntimeCamelException("Could not serialize " + message, e);
+            }
+
+            builder.header("content-type", "multipart/form-data; boundary=" + boundary);
+        }
+
+        public static BodyPublisher ofMimeMultipartData(Map<Object, Object> data, String boundary) throws IOException {
+            var byteArrays = new ArrayList<byte[]>();
+            byte[] separator = ("--" + boundary + "\r\nContent-Disposition: form-data; name=").getBytes(StandardCharsets.UTF_8);
+            for (Map.Entry<Object, Object> entry : data.entrySet()) {
+                byteArrays.add(separator);
+
+                if (entry.getValue() instanceof UploadMedia) {
+                    UploadMedia uploadMedia = (UploadMedia) entry.getValue();
+                    byteArrays.add(("\"" + entry.getKey() + "\"; filename=\"" + uploadMedia.getFile().toPath().getFileName()
+                                    + "\"\r\nContent-Type: " + uploadMedia.getContentType()
+                                    + "\r\n\r\n").getBytes(StandardCharsets.UTF_8));
+                    byteArrays.add(Files.readAllBytes(uploadMedia.getFile().toPath()));
+                    byteArrays.add("\r\n".getBytes(StandardCharsets.UTF_8));
+                } else {
+                    byteArrays.add(("\"" + entry.getKey() + "\"\r\n\r\n" + entry.getValue() + "\r\n")
+                            .getBytes(StandardCharsets.UTF_8));
+                }
+            }
+            byteArrays.add(("--" + boundary + "--\r\n").getBytes(StandardCharsets.UTF_8));
+            return BodyPublishers.ofByteArrays(byteArrays);

Review Comment:
   I'd avoid working directly with bytes here. Instead, I think you can make this code much simpler by using a `ByteBuffer` and then using it to generate the `byte[]` passed to the `BodyPublishers`.
   
   Among other things, it can also help avoiding the long chains of string concatenation (which could be problematic if this part of the code is in the hot path).
   
   



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884126421


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppProducer.java:
##########
@@ -0,0 +1,65 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.AsyncCallback;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.whatsapp.model.BaseMessage;
+import org.apache.camel.component.whatsapp.model.TextMessageRequest;
+import org.apache.camel.support.DefaultAsyncProducer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WhatsAppProducer extends DefaultAsyncProducer {
+	private static final Logger LOG = LoggerFactory.getLogger(WhatsAppProducer.class);
+
+	private WhatsAppEndpoint endpoint;
+
+	public WhatsAppProducer(WhatsAppEndpoint endpoint) {
+		super(endpoint);
+		this.endpoint = endpoint;
+	}
+
+	@Override
+	public boolean process(Exchange exchange, AsyncCallback callback) {
+		if (exchange.getIn().getBody() == null) {
+			// fail fast
+			LOG.debug("Received exchange with empty body, skipping");
+			callback.done(true);
+			return true;
+		}
+
+		WhatsAppConfiguration config = endpoint.getConfiguration();
+
+		// Tries to get a message in its OutgoingMessage format
+		// Automatic conversion applies here
+		BaseMessage message = exchange.getIn().getBody(BaseMessage.class);
+		if (message == null) {
+			throw new IllegalArgumentException("Cannot convert the content to a WhatsApp MessageRequest");
+		}
+
+		final WhatsAppService service = endpoint.getWhatsappService();
+
+		LOG.debug("Message being sent is: {}", message);
+		LOG.debug("Headers of message being sent are: {}", exchange.getIn().getHeaders());
+
+		service.sendMessage(exchange, callback, message);

Review Comment:
   an implementation is always provided in `WhatsAppEndpoint.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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141268872

   @orpiske I've dropped `async-http-client` and used java 11 http client instead, it is a bit low level as you can see from `ofMimeMultipartData` method, but it is working as expected.
   
   @oscerd I've fixed your requests, I'd like to open this MR, but the build keep failing, locally checkstyle is not failing, moreover I don't understand why github action tries to download the artifact camel-whatsapp.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1147111003

   > What's the status of this?
   
   Hello @oscerd i'm working on it, I'm refactoring HTTP client in order to use java11 one.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r894548559


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Objects;
+
+import org.apache.camel.RuntimeCamelException;
+
+public class UploadMedia {
+
+    private File file;
+    private String contentType;
+    private String name;
+    private InputStream fileStream;
+
+    public UploadMedia(File file, String contentType) {
+        Objects.nonNull(file);
+        Objects.nonNull(contentType);

Review Comment:
   This is exactly what I wanted



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] orpiske commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
orpiske commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r894511196


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+
+@Component("whatsapp")
+public class WhatsAppComponent extends DefaultComponent {
+
+    public static final String API_DEFAULT_URL = "https://graph.facebook.com";
+    public static final String API_DEFAULT_VERSION = "v13.0";
+
+    @Metadata(required = true, description = "Phone Number ID taken from WhatsApp Meta for Developers Dashboard")
+    private String phoneNumberId;
+    @Metadata(label = "security", secret = true, required = true,
+              description = "Authorization Token taken from WhatsApp Meta for Developers Dashboard")
+    private String authorizationToken;
+
+    @Metadata(label = "advanced", description = "Java 11 HttpClient implementation")
+    private HttpClient client;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_URL,
+              description = "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API")
+    private String baseUri = API_DEFAULT_URL;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_VERSION, description = "WhatsApp Cloud API version")
+    private String apiVersion = API_DEFAULT_VERSION;
+    @Metadata(description = "Webhook verify token", label = "advanced", secret = true)
+    private String webhookVerifyToken;
+
+    public WhatsAppComponent() {
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        WhatsAppConfiguration configuration = new WhatsAppConfiguration();
+
+        if (configuration.getBaseUri() == null) {
+            configuration.setBaseUri(baseUri);
+        }
+        if (configuration.getApiVersion() == null) {
+            configuration.setApiVersion(apiVersion);
+        }
+        if (configuration.getWebhookVerifyToken() == null) {
+            configuration.setWebhookVerifyToken(webhookVerifyToken);
+        }
+
+        configuration.setAuthorizationToken(authorizationToken);
+
+        if (remaining.endsWith("/")) {
+            remaining = remaining.substring(0, remaining.length() - 1);
+        }
+        configuration.setPhoneNumberId(remaining);
+
+        WhatsAppEndpoint endpoint = new WhatsAppEndpoint(uri, this, configuration, client);
+
+        setProperties(endpoint, parameters);
+
+        if (endpoint.getConfiguration().getAuthorizationToken() == null) {

Review Comment:
   Maybe use `ObjectHelper.isEmpty` here



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+import java.util.List;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.webhook.WebhookCapableEndpoint;
+import org.apache.camel.component.webhook.WebhookConfiguration;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send messages.
+ */
+@UriEndpoint(firstVersion = "3.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",
+             category = {
+                     Category.CLOUD, Category.API,
+                     Category.CHAT },
+             headersClass = WhatsAppConstants.class)
+public class WhatsAppEndpoint extends ScheduledPollEndpoint implements WebhookCapableEndpoint {
+    private static final Logger LOG = LoggerFactory.getLogger(WhatsAppEndpoint.class);
+
+    @UriParam
+    private WhatsAppConfiguration configuration;
+
+    @UriParam(label = "advanced", description = "HttpClient implementation")
+    private HttpClient httpClient;
+    @UriParam(label = "advanced", description = "WhatsApp service implementation")
+    private WhatsAppService whatsappService;
+
+    private WebhookConfiguration webhookConfiguration;
+
+    public WhatsAppEndpoint(String endpointUri, Component component, WhatsAppConfiguration configuration, HttpClient client) {
+        super(endpointUri, component);
+        this.configuration = configuration;
+        this.httpClient = client;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        if (httpClient == null) {
+            httpClient
+                    = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2).connectTimeout(Duration.ofSeconds(10)).build();
+        }
+        if (whatsappService == null) {
+            whatsappService = new WhatsAppServiceRestAPIAdapter(
+                    httpClient, configuration.getBaseUri(), configuration.getApiVersion(), configuration.getPhoneNumberId(),
+                    configuration.getAuthorizationToken());
+        }
+        LOG.debug("client {}" + httpClient);
+        LOG.debug("whatsappService {}" + whatsappService);

Review Comment:
   The logging is incorrect on these 2 lines. It should be:
   
   ```
   LOG.debug("client {}", httpClient);
   LOG.debug("whatsappService {}", whatsappService);
   ```



##########
components/camel-whatsapp/src/test/resources/log4j2.properties:
##########
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+##
+##      http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-whatsapp.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d %-5p %c{1} - %m %n
+appender.console.type = Console
+appender.console.name = console
+appender.console.layout.type = PatternLayout
+appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+logger.whatsapp.name = org.apache.camel.component.whatsapp
+logger.whatsapp.level = DEBUG
+rootLogger.level = INFO
+
+rootLogger.appenderRef.file.ref = file
+#rootLogger.appenderRef.console.ref = console

Review Comment:
   You can remove this line.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Objects;
+
+import org.apache.camel.RuntimeCamelException;
+
+public class UploadMedia {
+
+    private File file;
+    private String contentType;
+    private String name;
+    private InputStream fileStream;
+
+    public UploadMedia(File file, String contentType) {
+        Objects.nonNull(file);
+        Objects.nonNull(contentType);

Review Comment:
   I am not sure if that's what you intend here. The method `Objects.nonNull` returns a boolean ... maybe you want you to use `this.file = Objects.requireNonNull(file)`? Alternatively ... if this class is intended to be used only internally and both `file` and `contentType` are (almost) guaranteed to be non-null, an `assert file != null` can do the trick as well.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/model/UploadMedia.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp.model;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Objects;
+
+import org.apache.camel.RuntimeCamelException;
+
+public class UploadMedia {
+
+    private File file;
+    private String contentType;
+    private String name;
+    private InputStream fileStream;
+
+    public UploadMedia(File file, String contentType) {
+        Objects.nonNull(file);
+        Objects.nonNull(contentType);
+        if (!file.exists()) {
+            throw new RuntimeCamelException("The file provided does not exists");
+        }
+
+        this.file = file;
+        this.contentType = contentType;
+    }
+
+    public UploadMedia(String name, InputStream fileStream, String contentType) {
+        Objects.nonNull(name);
+        Objects.nonNull(fileStream);
+        Objects.nonNull(contentType);

Review Comment:
   Please see my comment about `Objects.nonNull` above.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] Croway commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
Croway commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1160139638

   > Whats the status of this PR. Is it good to be merged?
   
   Hello @davsclaus, from my point of view the following is missing:
   - producer unit test (with some mock)
   - webhook documentation
   - if you think that webhook and producer can be improved let me know please, I'm glad to add more features
   
   https://github.com/Croway/camel-examples/tree/camel-whatsapp-example/examples/whatsapp as you can see the example is a bit clunky (https://github.com/Croway/camel-examples/blob/camel-whatsapp-example/examples/whatsapp/src/main/java/org/apache/camel/example/whatsapp/WhatsappRouteBuilder.java#L34-L51)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] oscerd commented on a diff in pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
oscerd commented on code in PR #7683:
URL: https://github.com/apache/camel/pull/7683#discussion_r884437945


##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppComponent.java:
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+
+@Component("whatsapp")
+public class WhatsAppComponent extends DefaultComponent {
+
+    public static final String API_DEFAULT_URL = "https://graph.facebook.com";
+    public static final String API_DEFAULT_VERSION = "v13.0";
+
+    @Metadata(required = true, description = "TODO")
+    private String phoneNumberId;
+    @Metadata(label = "security", secret = true, required = true, description = "TODO")
+    private String authorizationToken;
+
+    @Metadata(label = "advanced", description = "TODO")
+    private AsyncHttpClient client;
+    @Metadata(label = "advanced", description = "TODO")
+    private AsyncHttpClientConfig clientConfig;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_URL,
+              description = "Can be used to set an alternative base URI, e.g. when you want to test the component against a mock WhatsApp API")
+    private String baseUri = API_DEFAULT_URL;
+    @Metadata(label = "advanced", defaultValue = API_DEFAULT_VERSION, description = "TODO")

Review Comment:
   Please remove the TODO here.



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+
+public final class WhatsAppConstants {
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")
+    public static final String WHATSAPP_PHONE_NUMBER_ID = "CamelWhatsAppPhoneNumberId";
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")

Review Comment:
   Remove todo



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIJDKAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+import org.asynchttpclient.DefaultAsyncHttpClient;
+import org.asynchttpclient.DefaultAsyncHttpClientConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send and receive messages.
+ */
+@UriEndpoint(firstVersion = "2.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",

Review Comment:
   First version is 3.18.0



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppConstants.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import org.apache.camel.spi.Metadata;
+
+public final class WhatsAppConstants {
+
+    @Metadata(label = "producer", description = "TODO", javaType = "Object")

Review Comment:
   Remove todo



##########
components/camel-whatsapp/src/main/java/org/apache/camel/component/whatsapp/WhatsAppEndpoint.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.whatsapp;
+
+import java.net.http.HttpClient;
+import java.time.Duration;
+
+import org.apache.camel.Category;
+import org.apache.camel.Component;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.whatsapp.service.WhatsAppServiceRestAPIJDKAdapter;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
+import org.asynchttpclient.AsyncHttpClient;
+import org.asynchttpclient.AsyncHttpClientConfig;
+import org.asynchttpclient.DefaultAsyncHttpClient;
+import org.asynchttpclient.DefaultAsyncHttpClientConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Send and receive messages.
+ */
+@UriEndpoint(firstVersion = "2.18.0", scheme = "whatsapp", title = "WhatsApp", syntax = "whatsapp:type",
+             category = {
+                     Category.CLOUD, Category.API,
+                     Category.CHAT },
+             headersClass = WhatsAppConstants.class)
+public class WhatsAppEndpoint extends ScheduledPollEndpoint {
+    private static final Logger LOG = LoggerFactory.getLogger(WhatsAppEndpoint.class);
+
+    @UriParam
+    private WhatsAppConfiguration configuration;
+    @UriParam(label = "advanced", description = "TODO")

Review Comment:
   Please remove the todo



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1141001717

   :x: Finished component verification: **2 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1139483751

   :warning: This PR changes Camel components and will be tested automatically.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152245365

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **2 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152234445

   :x: Finished component verification: **1 component(s) test failed** out of 2 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152138964

   There are too many components to be tested in this PR, components were removed or the code needs a rebase: (67 likely to be tested)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152426354

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **3 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] davsclaus commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
davsclaus commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1170233678

   @Croway we are closing in on releasing 3.18.0. Do you think this PR is a good start and then you can continue to improve this component for upcoming releases.
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1140485610

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1140997176

   :x: Finished component verification: **1 component(s) test failed** out of 6 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] oscerd commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
oscerd commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1147045126

   What's the status of this?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1152500515

   :x: Finished component verification: **1 component(s) test failed** out of 5 component(s) tested


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] oscerd commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
oscerd commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1174928573

   We missed this for 3.18.0, I'm going to merge it next week probably


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1167183009

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **2 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #7683: ✨ camel-whatsapp component

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #7683:
URL: https://github.com/apache/camel/pull/7683#issuecomment-1167239279

   :heavy_check_mark: Finished component verification: 0 component(s) test failed out of **3 component(s) tested**


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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