This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets-examples.git
The following commit(s) were added to refs/heads/main by this push:
new 213eabe CAMEL-18815: camel-jbang - Base package scan to search in
downloaded JARs
213eabe is described below
commit 213eabe17a11e532696622a755a31d1252bdc9a2
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Dec 18 12:32:43 2022 +0100
CAMEL-18815: camel-jbang - Base package scan to search in downloaded JARs
---
kamelet-main/{slack-source => custom}/pom.xml | 55 ++----------------
.../apache/camel/example/custom/BeerProcessor.java | 32 +++++++++++
.../camel/example/custom/CustomConfiguration.java | 29 ++++++++++
kamelet-main/pom.xml | 9 ++-
kamelet-main/scan-download/README.adoc | 67 ++++++++++++++++++++++
.../{slack-source => scan-download}/pom.xml | 10 ++--
.../example/scan/ScanDownloadApplication.java | 28 +++++++++
.../src/main/resources/application.properties | 26 +++++++++
.../src/main/resources/camel/my-route.yaml | 21 +++++++
.../kamelets/custom-beer-source.kamelet.yaml | 40 +++++++++++++
.../scan-download/src/main/resources/logback.xml | 30 ++++++++++
kamelet-main/scan/README.adoc | 67 ++++++++++++++++++++++
kamelet-main/{slack-source => scan}/pom.xml | 17 ++++--
.../apache/camel/example/scan/ScanApplication.java | 28 +++++++++
.../scan/src/main/resources/application.properties | 26 +++++++++
.../scan/src/main/resources/camel/my-route.yaml | 22 +++++++
kamelet-main/scan/src/main/resources/logback.xml | 30 ++++++++++
kamelet-main/slack-source/pom.xml | 2 +-
18 files changed, 475 insertions(+), 64 deletions(-)
diff --git a/kamelet-main/slack-source/pom.xml b/kamelet-main/custom/pom.xml
similarity index 54%
copy from kamelet-main/slack-source/pom.xml
copy to kamelet-main/custom/pom.xml
index 489a72f..c9ecf34 100644
--- a/kamelet-main/slack-source/pom.xml
+++ b/kamelet-main/custom/pom.xml
@@ -25,13 +25,13 @@
<parent>
<groupId>org.apache.camel.examples</groupId>
<artifactId>camel-kamelet-main-examples</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
</parent>
- <artifactId>slack-source</artifactId>
+ <artifactId>custom</artifactId>
<packaging>jar</packaging>
- <name>Camel :: Kamelet Main Example :: Slack Source</name>
- <description>Kamelet Main Slack Source</description>
+ <name>Camel :: Kamelet Main Example :: Custom JAR</name>
+ <description>Kamelet Main Custom JAR</description>
<dependencyManagement>
<dependencies>
@@ -48,11 +48,9 @@
<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>
+ <artifactId>camel-jq</artifactId>
</dependency>
<!-- logging -->
@@ -74,47 +72,4 @@
</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/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/BeerProcessor.java
b/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/BeerProcessor.java
new file mode 100644
index 0000000..3fd1d5b
--- /dev/null
+++
b/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/BeerProcessor.java
@@ -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.
+ */
+package org.apache.camel.example.custom;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+
+public class BeerProcessor implements Processor {
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+ JsonNode jn = exchange.getMessage().getBody(JsonNode.class);
+ String n = jn.get("name").textValue();
+ String a = jn.get("alcohol").textValue();
+ exchange.getMessage().setBody(n + " (" + a + ")");
+ }
+}
diff --git
a/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/CustomConfiguration.java
b/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/CustomConfiguration.java
new file mode 100644
index 0000000..63af125
--- /dev/null
+++
b/kamelet-main/custom/src/main/java/org/apache/camel/example/custom/CustomConfiguration.java
@@ -0,0 +1,29 @@
+/*
+ * 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.custom;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.CamelConfiguration;
+import org.apache.camel.Configuration;
+
+@Configuration
+public class CustomConfiguration implements CamelConfiguration {
+
+ @BindToRegistry("beerProcessor")
+ private BeerProcessor beer = new BeerProcessor();
+
+}
diff --git a/kamelet-main/pom.xml b/kamelet-main/pom.xml
index 738529e..6e9b1c6 100644
--- a/kamelet-main/pom.xml
+++ b/kamelet-main/pom.xml
@@ -23,22 +23,25 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dependencies</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.camel.examples</groupId>
<artifactId>camel-kamelet-main-examples</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Kamelet Main Examples</name>
<description>Kamelet Main Examples</description>
<properties>
- <camel.version>3.18.0-SNAPSHOT</camel.version>
+ <camel.version>3.20.0-SNAPSHOT</camel.version>
</properties>
<modules>
+ <module>custom</module>
+ <module>scan</module>
+ <module>scan-download</module>
<module>slack-source</module>
</modules>
</project>
diff --git a/kamelet-main/scan-download/README.adoc
b/kamelet-main/scan-download/README.adoc
new file mode 100644
index 0000000..40b7adb
--- /dev/null
+++ b/kamelet-main/scan-download/README.adoc
@@ -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/kamelet-main/slack-source/pom.xml
b/kamelet-main/scan-download/pom.xml
similarity index 93%
copy from kamelet-main/slack-source/pom.xml
copy to kamelet-main/scan-download/pom.xml
index 489a72f..d873ac8 100644
--- a/kamelet-main/slack-source/pom.xml
+++ b/kamelet-main/scan-download/pom.xml
@@ -25,13 +25,13 @@
<parent>
<groupId>org.apache.camel.examples</groupId>
<artifactId>camel-kamelet-main-examples</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
</parent>
- <artifactId>slack-source</artifactId>
+ <artifactId>scan-download</artifactId>
<packaging>jar</packaging>
- <name>Camel :: Kamelet Main Example :: Slack Source</name>
- <description>Kamelet Main Slack Source</description>
+ <name>Camel :: Kamelet Main Example :: Scan Download</name>
+ <description>Kamelet Main Scan with Download</description>
<dependencyManagement>
<dependencies>
@@ -100,7 +100,7 @@
</descriptorRefs>
<archive>
<manifest>
-
<mainClass>org.apache.camel.main.KameletMain</mainClass>
+
<mainClass>org.apache.camel.example.scan.ScanDownloadApplication</mainClass>
</manifest>
</archive>
</configuration>
diff --git
a/kamelet-main/scan-download/src/main/java/org/apache/camel/example/scan/ScanDownloadApplication.java
b/kamelet-main/scan-download/src/main/java/org/apache/camel/example/scan/ScanDownloadApplication.java
new file mode 100644
index 0000000..f602b46
--- /dev/null
+++
b/kamelet-main/scan-download/src/main/java/org/apache/camel/example/scan/ScanDownloadApplication.java
@@ -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.
+ */
+package org.apache.camel.example.scan;
+
+import org.apache.camel.main.KameletMain;
+
+public class ScanDownloadApplication {
+
+ public static void main(String[] args) throws Exception{
+ KameletMain main = new KameletMain();
+ main.run();
+ }
+
+}
diff --git
a/kamelet-main/scan-download/src/main/resources/application.properties
b/kamelet-main/scan-download/src/main/resources/application.properties
new file mode 100644
index 0000000..097ba77
--- /dev/null
+++ b/kamelet-main/scan-download/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## 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 = ScanDownload
+
+# scan this package for custom camel @Configuration (also in downloaded JARs)
+camel.main.base-package-scan-enabled = true
+camel.main.base-package-scan = org.apache.camel.example.custom
+
+
+
diff --git a/kamelet-main/scan-download/src/main/resources/camel/my-route.yaml
b/kamelet-main/scan-download/src/main/resources/camel/my-route.yaml
new file mode 100644
index 0000000..77bb500
--- /dev/null
+++ b/kamelet-main/scan-download/src/main/resources/camel/my-route.yaml
@@ -0,0 +1,21 @@
+## ---------------------------------------------------------------------------
+## 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:custom-beer-source"
+ steps:
+ - log: "${body}"
diff --git
a/kamelet-main/scan-download/src/main/resources/kamelets/custom-beer-source.kamelet.yaml
b/kamelet-main/scan-download/src/main/resources/kamelets/custom-beer-source.kamelet.yaml
new file mode 100644
index 0000000..a5fbbcc
--- /dev/null
+++
b/kamelet-main/scan-download/src/main/resources/kamelets/custom-beer-source.kamelet.yaml
@@ -0,0 +1,40 @@
+apiVersion: camel.apache.org/v1alpha1
+kind: Kamelet
+metadata:
+ name: custom-beer-source
+ annotations:
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/catalog.version: "main-SNAPSHOT"
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iOTJwdCIgd2lkdGg9IjkycHQiIHZlcnNpb249IjEuMCIgeG1sbnM6Y2M9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zIyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+Cg
[...]
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/kamelet.group: "Beers"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+spec:
+ definition:
+ title: "Beer Source"
+ description: "Produces periodic events about beers!"
+ type: object
+ properties:
+ period:
+ title: Period
+ description: The time interval between two events
+ type: integer
+ default: 5000
+ types:
+ out:
+ mediaType: application/json
+ dependencies:
+ - "camel:timer"
+ - "camel:http"
+ - "camel:kamelet"
+ - "mvn:org.apache.camel.examples:custom:3.20.0-SNAPSHOT"
+ template:
+ from:
+ uri: "timer:beer"
+ parameters:
+ period: "{{period}}"
+ steps:
+ - to: https://random-data-api.com/api/beer/random_beer
+ - bean: "beerProcessor"
+ - to: "kamelet:sink"
\ No newline at end of file
diff --git a/kamelet-main/scan-download/src/main/resources/logback.xml
b/kamelet-main/scan-download/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/kamelet-main/scan-download/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>
diff --git a/kamelet-main/scan/README.adoc b/kamelet-main/scan/README.adoc
new file mode 100644
index 0000000..40b7adb
--- /dev/null
+++ b/kamelet-main/scan/README.adoc
@@ -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/kamelet-main/slack-source/pom.xml b/kamelet-main/scan/pom.xml
similarity index 89%
copy from kamelet-main/slack-source/pom.xml
copy to kamelet-main/scan/pom.xml
index 489a72f..42b31aa 100644
--- a/kamelet-main/slack-source/pom.xml
+++ b/kamelet-main/scan/pom.xml
@@ -25,13 +25,13 @@
<parent>
<groupId>org.apache.camel.examples</groupId>
<artifactId>camel-kamelet-main-examples</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
</parent>
- <artifactId>slack-source</artifactId>
+ <artifactId>scan</artifactId>
<packaging>jar</packaging>
- <name>Camel :: Kamelet Main Example :: Slack Source</name>
- <description>Kamelet Main Slack Source</description>
+ <name>Camel :: Kamelet Main Example :: Scan</name>
+ <description>Kamelet Main Scan</description>
<dependencyManagement>
<dependencies>
@@ -48,6 +48,13 @@
<dependencies>
+ <!-- custom JAR -->
+ <dependency>
+ <groupId>org.apache.camel.examples</groupId>
+ <artifactId>custom</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<!-- easy way to boostrap and run Kamelet in standalone mode -->
<!-- the kamelet will be downloaded from the internet and 3rd party
JAR dependencies -->
<dependency>
@@ -100,7 +107,7 @@
</descriptorRefs>
<archive>
<manifest>
-
<mainClass>org.apache.camel.main.KameletMain</mainClass>
+
<mainClass>org.apache.camel.example.scan.ScanDownloadApplication</mainClass>
</manifest>
</archive>
</configuration>
diff --git
a/kamelet-main/scan/src/main/java/org/apache/camel/example/scan/ScanApplication.java
b/kamelet-main/scan/src/main/java/org/apache/camel/example/scan/ScanApplication.java
new file mode 100644
index 0000000..ee1372a
--- /dev/null
+++
b/kamelet-main/scan/src/main/java/org/apache/camel/example/scan/ScanApplication.java
@@ -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.
+ */
+package org.apache.camel.example.scan;
+
+import org.apache.camel.main.KameletMain;
+
+public class ScanApplication {
+
+ public static void main(String[] args) throws Exception{
+ KameletMain main = new KameletMain();
+ main.run();
+ }
+
+}
diff --git a/kamelet-main/scan/src/main/resources/application.properties
b/kamelet-main/scan/src/main/resources/application.properties
new file mode 100644
index 0000000..b65bd43
--- /dev/null
+++ b/kamelet-main/scan/src/main/resources/application.properties
@@ -0,0 +1,26 @@
+## ---------------------------------------------------------------------------
+## 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 = Scan
+
+# scan this package for custom camel @Configuration (also in downloaded JARs)
+camel.main.base-package-scan-enabled = true
+camel.main.base-package-scan = org.apache.camel.example.custom
+
+
+
diff --git a/kamelet-main/scan/src/main/resources/camel/my-route.yaml
b/kamelet-main/scan/src/main/resources/camel/my-route.yaml
new file mode 100644
index 0000000..8b7a6d6
--- /dev/null
+++ b/kamelet-main/scan/src/main/resources/camel/my-route.yaml
@@ -0,0 +1,22 @@
+## ---------------------------------------------------------------------------
+## 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:beer-source"
+ steps:
+ - bean: "beerProcessor"
+ - log: "${body}"
diff --git a/kamelet-main/scan/src/main/resources/logback.xml
b/kamelet-main/scan/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/kamelet-main/scan/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>
diff --git a/kamelet-main/slack-source/pom.xml
b/kamelet-main/slack-source/pom.xml
index 489a72f..67b4773 100644
--- a/kamelet-main/slack-source/pom.xml
+++ b/kamelet-main/slack-source/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.camel.examples</groupId>
<artifactId>camel-kamelet-main-examples</artifactId>
- <version>3.18.0-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
</parent>
<artifactId>slack-source</artifactId>