You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by df...@apache.org on 2021/04/20 18:16:41 UTC

[camel-examples] 05/35: Added an AWS2-S3 Stream Mode example

This is an automated email from the ASF dual-hosted git repository.

dfoulks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git

commit 6b498dec65498324691342a60dc7a92b9046aba4
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Apr 1 17:38:57 2021 +0200

    Added an AWS2-S3 Stream Mode example
---
 .../src/main/java/org/apache/camel/example/MyRouteBuilder.java   | 8 ++++++--
 .../src/main/resources/application.properties                    | 9 +++++----
 examples/pom.xml                                                 | 1 +
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/examples/main-endpointdsl-kafka-aws2-s3/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/main-endpointdsl-kafka-aws2-s3/src/main/java/org/apache/camel/example/MyRouteBuilder.java
index 75d11b3..d46ed3a 100644
--- a/examples/main-endpointdsl-kafka-aws2-s3/src/main/java/org/apache/camel/example/MyRouteBuilder.java
+++ b/examples/main-endpointdsl-kafka-aws2-s3/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -26,8 +26,12 @@ public class MyRouteBuilder extends EndpointRouteBuilder {
     public void configure() throws Exception {
 
         
-        from(kafka("{{kafkaTopic}}").brokers("{{kafkaBrokers}}"))
+        from(kafka("{{kafkaTopic1}}").brokers("{{kafkaBrokers}}"))
             .log("Kafka Message is: ${body}")
-        .to(aws2S3("{{bucketName}}").streamMode(true).batchMessageNumber(25).namingStrategy(AWS2S3EndpointBuilderFactory.AWSS3NamingStrategyEnum.progressive).keyName("{{kafkaTopic}}.txt"));
+        .to(aws2S3("{{bucketName}}").streamMode(true).batchMessageNumber(25).namingStrategy(AWS2S3EndpointBuilderFactory.AWSS3NamingStrategyEnum.progressive).keyName("{{kafkaTopic1}}/{{kafkaTopic1}}.txt"));
+
+        from(kafka("{{kafkaTopic2}}").brokers("{{kafkaBrokers}}"))
+                .log("Kafka Message is: ${body}")
+                .to(aws2S3("{{bucketName}}").streamMode(true).batchMessageNumber(25).namingStrategy(AWS2S3EndpointBuilderFactory.AWSS3NamingStrategyEnum.progressive).keyName("{{kafkaTopic2}}/{{kafkaTopic2}}.txt"));
     }
 }
diff --git a/examples/main-endpointdsl-kafka-aws2-s3/src/main/resources/application.properties b/examples/main-endpointdsl-kafka-aws2-s3/src/main/resources/application.properties
index f83da18..6ed7ff6 100644
--- a/examples/main-endpointdsl-kafka-aws2-s3/src/main/resources/application.properties
+++ b/examples/main-endpointdsl-kafka-aws2-s3/src/main/resources/application.properties
@@ -17,13 +17,14 @@
 
 # to configure camel main
 # here you can configure options on camel main (see MainConfigurationProperties class)
-camel.main.name = Kafka-to-AWS2-S3-Producer
+camel.main.name = Kafka-to-AWS2-S3-Stream
 
 # properties used in the route
-camel.component.aws2-s3.accessKey=xxxx
-camel.component.aws2-s3.secretKey=yyyy
+camel.component.aws2-s3.accessKey=xxxxx
+camel.component.aws2-s3.secretKey=yyyyy
 camel.component.aws2-s3.region=region
 bucketName=mycamel-1
 
-kafkaTopic=s3.topic
+kafkaTopic1=s3.topic.1
+kafkaTopic2=s3.topic.2
 kafkaBrokers=localhost:9092
diff --git a/examples/pom.xml b/examples/pom.xml
index b52645d..74bd0c3 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -133,6 +133,7 @@
         <module>main-endpointdsl-aws2-s3</module>
         <module>main-endpointdsl-aws2-s3-kafka</module>
         <module>main-endpointdsl-google-pubsub</module>
+        <module>main-endpointdsl-kafka-aws2-s3</module>
         <module>main-health</module>
         <module>main-joor</module>
         <module>main-lambda</module>