You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/08/10 14:03:35 UTC

[GitHub] [camel-quarkus-examples] aldettinger commented on a change in pull request #52: Added the module Deploying a Camel Route in AWS Lambda to the examples

aldettinger commented on a change in pull request #52:
URL: https://github.com/apache/camel-quarkus-examples/pull/52#discussion_r686040151



##########
File path: aws-lambda/pom.xml
##########
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>io.quarkus.camel</groupId>
+  <artifactId>aws-lambda</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <properties>

Review comment:
       I would align the pom taking example [here](https://github.com/apache/camel-quarkus-examples/blob/main/timer-log-cdi/pom.xml). Especially, is the quarkus-platform-bom really needed ? Is the surefire-plugin.version property really needed ?

##########
File path: aws-lambda/.gitignore
##########
@@ -0,0 +1,39 @@
+#Maven

Review comment:
       Looking at other example, I would say .gitignore and LICENSE are stored at the root folder of camel-quarkus-example. Maybe we could delete them from aws-lambda folder then ?

##########
File path: aws-lambda/mvnw
##########
@@ -0,0 +1,310 @@
+#!/bin/sh

Review comment:
       Same way, **mvnw** and **mvnw.cmd** seems not to be included in other examples folder.

##########
File path: aws-lambda/pom.xml
##########
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<!--
+    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.
+-->
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>io.quarkus.camel</groupId>
+  <artifactId>aws-lambda</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <properties>
+    <compiler-plugin.version>3.8.1</compiler-plugin.version>
+    <maven.compiler.parameters>true</maven.compiler.parameters>
+    <maven.compiler.source>11</maven.compiler.source>
+    <maven.compiler.target>11</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+    <quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
+    <quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
+    <quarkus.platform.version>2.1.0.Final</quarkus.platform.version>
+    <camel-quarkus.version>2.1.0</camel-quarkus.version>
+    <surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
+  </properties>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>${quarkus.platform.group-id}</groupId>
+        <artifactId>${quarkus.platform.artifact-id}</artifactId>
+        <version>${quarkus.platform.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel.quarkus</groupId>
+        <artifactId>camel-quarkus-bom</artifactId>
+        <version>${camel-quarkus.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-direct</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-log</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.quarkus</groupId>
+      <artifactId>camel-quarkus-bean</artifactId>

Review comment:
       Maybe camel-quarkus-bean is now useless as we have removed the bean statement from the route.

##########
File path: aws-lambda/src/main/docker/Dockerfile.legacy-jar
##########
@@ -0,0 +1,51 @@
+####

Review comment:
       Maybe the legacy docker file could be removed ?

##########
File path: aws-lambda/src/main/java/io/quarkus/camel/GreetService.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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 io.quarkus.camel;
+
+import javax.enterprise.context.ApplicationScoped;
+
+
+//@RegisterForReflection is required if you want to invoke this bean's methods via Bean Component / EIP in your camel route

Review comment:
       Same way, I would remove the comments related to bean and reflection.

##########
File path: aws-lambda/src/main/resources/application.properties
##########
@@ -0,0 +1,16 @@
+## ---------------------------------------------------------------------------

Review comment:
       We tend to remove empty application.properties file.

##########
File path: aws-lambda/.dockerignore
##########
@@ -0,0 +1,5 @@
+*

Review comment:
       Taking timer-log-cdi as example, the .dockerignore, .gitattributes files have not been pushed to the repository. Maybe we could delete them ?

##########
File path: aws-lambda/src/test/java/io/quarkus/camel/AWSLambdaHandlerTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * 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 io.quarkus.camel;
+
+import io.quarkus.amazon.lambda.test.LambdaClient;
+import io.quarkus.test.junit.QuarkusMock;
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import javax.inject.Inject;
+
+@QuarkusTest
+public class AWSLambdaHandlerTest {
+
+    @Inject

Review comment:
       It's really great to have a test for maintenance purpose :+1: And in such situation, it should be possible to write less code with [@InjectMock](https://camel.apache.org/blog/2020/10/mocking-beans-with-camel-quarkus/)

##########
File path: aws-lambda/src/main/java/io/quarkus/camel/CamelRoute.java
##########
@@ -0,0 +1,43 @@
+/*
+ * 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 io.quarkus.camel;
+
+import org.apache.camel.builder.RouteBuilder;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class CamelRoute extends RouteBuilder {
+
+   @Inject
+   GreetService greetService;
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:input").routeId("Test")
+           .log("Inside Camel Route Received Payload ==> ${body}")
+           /*

Review comment:
       I would remove the comments related to bean and reflection. The example is already great without bean :+1: 




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