You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/09/22 16:27:45 UTC
[camel-spring-boot-examples] 01/04: Added a little example for
AWS2-S3
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git
commit 5e6656c4e48b5c41053d8e1452249ab041344dcc
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Sep 22 18:20:34 2020 +0200
Added a little example for AWS2-S3
---
camel-example-spring-boot-aws2-s3/README.adoc | 33 ++++++++
camel-example-spring-boot-aws2-s3/pom.xml | 88 ++++++++++++++++++++++
.../example/springboot/aws2s3/Application.java | 34 +++++++++
.../example/springboot/aws2s3/CamelRoute.java | 31 ++++++++
.../src/main/resources/application.properties | 23 ++++++
.../src/main/resources/logback.xml | 36 +++++++++
pom.xml | 1 +
7 files changed, 246 insertions(+)
diff --git a/camel-example-spring-boot-aws2-s3/README.adoc b/camel-example-spring-boot-aws2-s3/README.adoc
new file mode 100644
index 0000000..3120529
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/README.adoc
@@ -0,0 +1,33 @@
+== Spring Boot Example with AWS2-S3
+
+=== Introduction
+
+This example demonstrates how you can use Camel-AWS2-S3 Starter component. The example is really simple: load file into your bucket and consume it.
+
+=== Build
+
+You can build this example using:
+
+ $ mvn package
+
+=== Run
+
+You can run this example following these steps using:
+
+In application.properties set all the AWS credentials and the bucket name
+
+Run the app
+
+ $ mvn spring-boot:run
+
+And you should see output in the console.
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/support.html[let us know].
+
+We also love contributors, so
+https://camel.apache.org/contributing.html[get involved] :-)
+
+The Camel riders!
diff --git a/camel-example-spring-boot-aws2-s3/pom.xml b/camel-example-spring-boot-aws2-s3/pom.xml
new file mode 100644
index 0000000..f510b81
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.springboot.example</groupId>
+ <artifactId>examples</artifactId>
+ <version>3.6.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-spring-boot-aws2-s3</artifactId>
+ <name>Camel SB Examples :: AWS2 S3</name>
+ <description>An example showing the Camel AWS2 S3 component with Spring Boot</description>
+
+ <properties>
+ <category>Database</category>
+ <spring.boot-version>${spring-boot-version}</spring.boot-version>
+ </properties>
+
+ <!-- Spring-Boot and Camel BOM -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.boot-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.springboot</groupId>
+ <artifactId>camel-spring-boot-dependencies</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- Camel -->
+ <dependency>
+ <groupId>org.apache.camel.springboot</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.springboot</groupId>
+ <artifactId>camel-aws2-s3-starter</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring.boot-version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
diff --git a/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/Application.java b/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/Application.java
new file mode 100644
index 0000000..19e8609
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/Application.java
@@ -0,0 +1,34 @@
+/*
+ * 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.example.springboot.aws2s3;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+// CHECKSTYLE:OFF
+@SpringBootApplication
+public class Application {
+
+ /**
+ * Main method to start the application.
+ */
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
+// CHECKSTYLE:ON
diff --git a/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/CamelRoute.java b/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/CamelRoute.java
new file mode 100644
index 0000000..5a826f1
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/src/main/java/org/apache/camel/example/springboot/aws2s3/CamelRoute.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.example.springboot.aws2s3;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CamelRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+
+ from("aws2-s3://{{bucketName}}")
+ .log("Received body: ${body}");
+ }
+}
diff --git a/camel-example-spring-boot-aws2-s3/src/main/resources/application.properties b/camel-example-spring-boot-aws2-s3/src/main/resources/application.properties
new file mode 100644
index 0000000..fb7b353
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/src/main/resources/application.properties
@@ -0,0 +1,23 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+camel.component.aws2-s3.accessKey=xxxx
+camel.component.aws2-s3.secretKey=yyyy
+camel.component.aws2-s3.region=region
+camel.springboot.main-run-controller=true
+logging.config=classpath:logback.xml
+bucketName=camel-kafka-connector
+
diff --git a/camel-example-spring-boot-aws2-s3/src/main/resources/logback.xml b/camel-example-spring-boot-aws2-s3/src/main/resources/logback.xml
new file mode 100644
index 0000000..0e4d220
--- /dev/null
+++ b/camel-example-spring-boot-aws2-s3/src/main/resources/logback.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%-15.15thread] %-5level %-30.30logger - %msg%n</pattern>
+ </encoder>
+ <file>target/camel-example-spring-boot-aws2-s3-1.log</file>
+ </appender>
+ <root level="INFO">
+ <!--<appender-ref ref="FILE"/>-->
+ <appender-ref ref="STDOUT"/>
+ </root>
+</configuration>
diff --git a/pom.xml b/pom.xml
index a919e91..737c2ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,6 +39,7 @@
<module>camel-example-spring-boot-amqp</module>
<module>camel-example-spring-boot-apm-opentracing</module>
<module>camel-example-spring-boot-arangodb</module>
+ <module>camel-example-spring-boot-aws2-s3</module>
<module>camel-example-spring-boot-clustered-route-controller</module>
<module>camel-example-spring-boot-fhir</module>
<module>camel-example-spring-boot-fhir-auth-tx</module>