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/01/05 10:42:30 UTC

[camel] 01/01: DO NOT MERGE: Camel-JFR for camel-jbang attempt

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

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

commit d50bff1c92845ec5271235e637955a1e05e93f2d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Jan 5 11:41:24 2022 +0100

    DO NOT MERGE: Camel-JFR for camel-jbang attempt
---
 .../main/java/org/apache/camel/dsl/jbang/core/commands/Run.java  | 9 +++++++++
 dsl/camel-jbang/camel-jbang-main/examples/earthquake.yaml        | 9 ++++-----
 dsl/camel-kamelet-main/pom.xml                                   | 4 ++++
 3 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 655f73d..ae32a24 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -78,6 +78,10 @@ class Run implements Callable<Integer> {
             description = "Whether to create a temporary file lock, which upon deleting triggers this process to terminate")
     private boolean fileLock = true;
 
+    @Option(names = { "--jfr" },
+            description = "Whether to start the jfr recorder or not")
+    private boolean jfr;
+
     @Option(names = { "--local-kamelet-dir" },
             description = "Local directory to load Kamelets from (take precedence))")
     private String localKameletDir;
@@ -142,6 +146,11 @@ class Run implements Callable<Integer> {
             main.addInitialProperty("camel.jbang.platform-http.port", String.valueOf(port));
         }
 
+        if (jfr) {
+            main.addInitialProperty("camel.main.startup-recorder", "java-flight-recorder");
+            main.addInitialProperty("camel.main.startupRecorderRecording", "true");
+        }
+
         if (fileLock) {
             lockFile = createLockFile();
             if (!lockFile.exists()) {
diff --git a/dsl/camel-jbang/camel-jbang-main/examples/earthquake.yaml b/dsl/camel-jbang/camel-jbang-main/examples/earthquake.yaml
index 5e83825..71c196a 100644
--- a/dsl/camel-jbang/camel-jbang-main/examples/earthquake.yaml
+++ b/dsl/camel-jbang/camel-jbang-main/examples/earthquake.yaml
@@ -15,8 +15,7 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 - route:
-    from: "kamelet:earthquake-source"
-    steps:
-      - unmarshal:
-          json: {}
-      - log: "Earthquake with magnitude ${body[properties][mag]} at ${body[properties][place]}"
+    from:
+      uri: "kamelet:earthquake-source"
+      steps:
+        - log: "${body}"
diff --git a/dsl/camel-kamelet-main/pom.xml b/dsl/camel-kamelet-main/pom.xml
index f70c5cd..fe412cc 100644
--- a/dsl/camel-kamelet-main/pom.xml
+++ b/dsl/camel-kamelet-main/pom.xml
@@ -60,6 +60,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jfr</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
             <artifactId>camel-grape</artifactId>
         </dependency>
         <dependency>