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 2022/03/25 11:09:20 UTC

[camel-kamelets-examples] branch main updated (a189ed1 -> 04a4cf5)

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

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


    from a189ed1  Added Slack source Kamelet example through camel-jbang
     new 6610575  Added Slack Source Example through Camel-Kamelet-main
     new 8d14746  Renamed camel-kamelet-main to kamelet-main
     new 04a4cf5  Added .gitignore

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |   1 +
 kamelet-main/pom.xml                               |  44 ++++++++
 kamelet-main/slack-source/README.md                |  67 ++++++++++++
 kamelet-main/slack-source/pom.xml                  | 120 +++++++++++++++++++++
 .../src/main/resources/application.properties      |  21 ++--
 .../src/main/resources/camel/my-route.yaml         |   0
 .../slack-source/src/main/resources/logback.xml    |  30 ++++++
 7 files changed, 271 insertions(+), 12 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 kamelet-main/pom.xml
 create mode 100644 kamelet-main/slack-source/README.md
 create mode 100644 kamelet-main/slack-source/pom.xml
 copy jbang/slack-source/slack-source.yaml => kamelet-main/slack-source/src/main/resources/application.properties (77%)
 copy jbang/slack-source/slack-source.yaml => kamelet-main/slack-source/src/main/resources/camel/my-route.yaml (100%)
 create mode 100644 kamelet-main/slack-source/src/main/resources/logback.xml

[camel-kamelets-examples] 02/03: Renamed camel-kamelet-main to kamelet-main

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 8d14746e77bf676384db14b2d90de9592cccafac
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 25 12:08:17 2022 +0100

    Renamed camel-kamelet-main to kamelet-main
---
 {camel-kamelet-main => kamelet-main}/pom.xml                              | 0
 {camel-kamelet-main => kamelet-main}/slack-source/README.md               | 0
 {camel-kamelet-main => kamelet-main}/slack-source/pom.xml                 | 0
 .../slack-source/src/main/resources/application.properties                | 0
 .../slack-source/src/main/resources/camel/my-route.yaml                   | 0
 .../slack-source/src/main/resources/logback.xml                           | 0
 6 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/camel-kamelet-main/pom.xml b/kamelet-main/pom.xml
similarity index 100%
rename from camel-kamelet-main/pom.xml
rename to kamelet-main/pom.xml
diff --git a/camel-kamelet-main/slack-source/README.md b/kamelet-main/slack-source/README.md
similarity index 100%
rename from camel-kamelet-main/slack-source/README.md
rename to kamelet-main/slack-source/README.md
diff --git a/camel-kamelet-main/slack-source/pom.xml b/kamelet-main/slack-source/pom.xml
similarity index 100%
rename from camel-kamelet-main/slack-source/pom.xml
rename to kamelet-main/slack-source/pom.xml
diff --git a/camel-kamelet-main/slack-source/src/main/resources/application.properties b/kamelet-main/slack-source/src/main/resources/application.properties
similarity index 100%
rename from camel-kamelet-main/slack-source/src/main/resources/application.properties
rename to kamelet-main/slack-source/src/main/resources/application.properties
diff --git a/camel-kamelet-main/slack-source/src/main/resources/camel/my-route.yaml b/kamelet-main/slack-source/src/main/resources/camel/my-route.yaml
similarity index 100%
rename from camel-kamelet-main/slack-source/src/main/resources/camel/my-route.yaml
rename to kamelet-main/slack-source/src/main/resources/camel/my-route.yaml
diff --git a/camel-kamelet-main/slack-source/src/main/resources/logback.xml b/kamelet-main/slack-source/src/main/resources/logback.xml
similarity index 100%
rename from camel-kamelet-main/slack-source/src/main/resources/logback.xml
rename to kamelet-main/slack-source/src/main/resources/logback.xml

[camel-kamelets-examples] 03/03: Added .gitignore

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 04a4cf5c4c58b63ccdae45523371397a89a86dd9
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 25 12:08:35 2022 +0100

    Added .gitignore
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2f7896d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+target/

[camel-kamelets-examples] 01/03: Added Slack Source Example through Camel-Kamelet-main

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 66105751480c0b0a412674752210b453b9db8934
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Mar 25 12:07:51 2022 +0100

    Added Slack Source Example through Camel-Kamelet-main
---
 camel-kamelet-main/pom.xml                         |  44 ++++++++
 camel-kamelet-main/slack-source/README.md          |  67 ++++++++++++
 camel-kamelet-main/slack-source/pom.xml            | 120 +++++++++++++++++++++
 .../src/main/resources/application.properties      |  25 +++++
 .../src/main/resources/camel/my-route.yaml         |  28 +++++
 .../slack-source/src/main/resources/logback.xml    |  30 ++++++
 6 files changed, 314 insertions(+)

diff --git a/camel-kamelet-main/pom.xml b/camel-kamelet-main/pom.xml
new file mode 100644
index 0000000..a416b72
--- /dev/null
+++ b/camel-kamelet-main/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+
+    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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-dependencies</artifactId>
+        <version>3.17.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.camel.examples</groupId>
+    <artifactId>camel-kamelet-main-examples</artifactId>
+    <version>3.17.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <name>Kamelet Main Examples</name>
+    <description>Kamelet Main Examples</description>
+
+    <properties>
+       <camel.version>3.17.0-SNAPSHOT</camel.version>
+    </properties>
+
+    <modules>
+        <module>slack-source</module>
+    </modules>
+</project>
diff --git a/camel-kamelet-main/slack-source/README.md b/camel-kamelet-main/slack-source/README.md
new file mode 100644
index 0000000..40b7adb
--- /dev/null
+++ b/camel-kamelet-main/slack-source/README.md
@@ -0,0 +1,67 @@
+== Slack Source Example
+
+In this sample you'll use the Slack Source Kamelet throught camel-kamelet-main
+
+=== Setup the Slack Bot App
+
+1. Go to https://api.slack.com/apps and create an app
+2. Set the following permissions to this app, in particular in relation to Bot Token
+- channels:history
+- groups:history
+- im:history
+- mpim:history
+- channels:read
+- groups:read
+- im:read
+- mpim:read
+3. Enable incoming webhook for this Bot App
+4. Copy the User OAuth Token 
+5. Open the slack-integration.properties file and paste the token as token property
+6. Set the correct channel name
+
+=== Run
+
+Run the following command:
+
+```
+> mvn clean install
+> mvn camel:dev
+```
+
+You should see
+
+```
+[INFO] Starting Camel ...
+18:07:31.131 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Detected: camel-debug JAR (enabling Camel Debugging)
+18:07:32.711 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.DownloaderHelper - Downloaded dependency: org.apache.camel:camel-kamelet:3.15.0 took: 1s492ms
+18:07:32.787 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport - Auto-configuration summary
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.name=Slack-source
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.routesReloadDirectoryRecursive=true
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.routesReloadDirectory=/home/oscerd/workspace/miscellanea/kamelet-samples/camel-kamelet-main/slack-source/src/main/resources
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.durationMaxAction=stop
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.routesReloadEnabled=true
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.sourceLocationEnabled=true
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.main.routesReloadPattern=*.xml,*.yaml,*.java
+18:07:32.788 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.BaseMainSupport -     camel.component.kamelet.location=classpath:/kamelets,github:apache:camel-kamelets/kamelets
+18:07:32.966 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.DownloaderHelper - Downloaded dependency: org.apache.camel:camel-core-languages:3.15.0 took: 79ms
+18:07:32.969 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.m.JmxManagementStrategy - JMX is enabled
+18:07:33.826 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.DownloaderHelper - Downloaded dependency: org.apache.camel:camel-gson:3.15.0 took: 112ms
+18:07:33.949 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.DownloaderHelper - Downloaded dependency: org.apache.camel:camel-slack:3.15.0 took: 122ms
+18:07:35.088 [org.apache.camel.main.KameletMain.main()] INFO  o.apache.camel.main.DownloaderHelper - Downloaded dependency: org.apache.camel:camel-log:3.15.0 took: 768ms
+18:07:35.273 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.s.FileWatcherResourceReloadStrategy - Starting ReloadStrategy to watch directory: /home/oscerd/workspace/miscellanea/kamelet-samples/camel-kamelet-main/slack-source/src/main/resources
+18:07:36.242 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Routes startup (total:3 started:3)
+18:07:36.242 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Started route1 (kamelet://slack-source)
+18:07:36.242 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Started slack-source-1 (slack://general)
+18:07:36.242 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Started log-sink-2 (kamelet://source)
+18:07:36.242 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Apache Camel 3.15.0 (Slack-source) started in 3s502ms (build:135ms init:2s222ms start:1s145ms)
+18:07:36.243 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.impl.debugger.BacklogDebugger - Enabling debugger
+18:07:37.546 [Camel (Slack-source) thread #2 - slack://general] INFO  info - Exchange[ExchangePattern: InOnly, Headers: {Content-Type=application/json}, BodyType: byte[], Body: {"type":"message","team":"xxxx","user":"yyyy","text":"hello","blocks":[{"type":"rich_text","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"hello"}]}],"blockId":"XAE5"}],"ts":"1646919166.690039","is_intro":false,"is_starred":false,"wibblr":false,"displayAsBot":false,"upload":false,"client [...]
+^C18:07:41.739 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Apache Camel 3.15.0 (Slack-source) shutting down (timeout:45s)
+18:07:41.773 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Routes stopped (total:3 stopped:3)
+18:07:41.773 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Stopped log-sink-2 (kamelet://source)
+18:07:41.773 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Stopped slack-source-1 (slack://general)
+18:07:41.773 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext -     Stopped route1 (kamelet://slack-source)
+18:07:43.286 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.impl.debugger.BacklogDebugger - Disabling debugger
+18:07:43.292 [org.apache.camel.main.KameletMain.main()] INFO  o.a.c.i.engine.AbstractCamelContext - Apache Camel 3.15.0 (Slack-source) shutdown in 1s552ms (uptime:8s194ms)
+
+```
diff --git a/camel-kamelet-main/slack-source/pom.xml b/camel-kamelet-main/slack-source/pom.xml
new file mode 100644
index 0000000..bc85a34
--- /dev/null
+++ b/camel-kamelet-main/slack-source/pom.xml
@@ -0,0 +1,120 @@
+<?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/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel.examples</groupId>
+        <artifactId>camel-kamelet-main-examples</artifactId>
+        <version>3.17.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>slack-source</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Kamelet Main Example :: Slack Source</name>
+    <description>Kamelet Main Slack Source</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Add Camel BOM -->
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bom</artifactId>
+                <version>${camel.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <!-- easy way to boostrap and run Kamelet in standalone mode -->
+        <!-- the kamelet will be downloaded from the internet and 3rd party JAR dependencies -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-kamelet-main</artifactId>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <version>${log4j2-version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-maven-plugin</artifactId>
+                <version>${camel.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <!-- to be able to make a fat-jar via the maven-assembly-plugin -->
+                            <goal>prepare-fatjar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- build a fat-jar -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <configuration>
+                    <descriptorRefs>
+                        <descriptorRef>jar-with-dependencies</descriptorRef>
+                    </descriptorRefs>
+                    <archive>
+                        <manifest>
+                            <mainClass>org.apache.camel.main.KameletMain</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/camel-kamelet-main/slack-source/src/main/resources/application.properties b/camel-kamelet-main/slack-source/src/main/resources/application.properties
new file mode 100644
index 0000000..471caa3
--- /dev/null
+++ b/camel-kamelet-main/slack-source/src/main/resources/application.properties
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# to configure camel main
+camel.main.name = Slack-source
+
+# slack specific parameters
+channel = general
+token = <token>
+
+
diff --git a/camel-kamelet-main/slack-source/src/main/resources/camel/my-route.yaml b/camel-kamelet-main/slack-source/src/main/resources/camel/my-route.yaml
new file mode 100644
index 0000000..0e79d22
--- /dev/null
+++ b/camel-kamelet-main/slack-source/src/main/resources/camel/my-route.yaml
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+- route:
+    from:
+      uri: "kamelet:slack-source"
+      parameters:
+        channel: "{{channel}}"
+        token: "{{token}}"
+      steps:
+        - to: 
+            uri: "kamelet:log-sink"
+            parameters:
+              showStreams: true
+              showHeaders: true
diff --git a/camel-kamelet-main/slack-source/src/main/resources/logback.xml b/camel-kamelet-main/slack-source/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/camel-kamelet-main/slack-source/src/main/resources/logback.xml
@@ -0,0 +1,30 @@
+<?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} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>