You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/08/31 08:11:37 UTC
(camel) branch main updated (e313c8dc437 -> edeef4ff003)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
from e313c8dc437 CAMEL-22392: camel-resilience4j - Add micrometer support
new 3d0ae34face CAMEL-22337: camel-jbang debug for camel quarkus
new edeef4ff003 Polished
The 2 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:
.../main/java/org/apache/camel/util/TimeUtils.java | 2 +-
.../camel/dsl/jbang/core/commands/Debug.java | 120 ++++++++++++++++++++-
2 files changed, 119 insertions(+), 3 deletions(-)
(camel) 02/02: Polished
Posted by da...@apache.org.
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.git
commit edeef4ff0035ad80d0698e5fa2469dee612f07a1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Aug 31 10:11:24 2025 +0200
Polished
---
core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java b/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
index df1d3c4dcfa..30d345bf906 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/TimeUtils.java
@@ -269,7 +269,7 @@ public final class TimeUtils {
answer += 86400000 * days;
}
- LOG.trace("source: [{}], milliseconds: {}", source, answer);
+ LOG.trace("input: [{}], milliseconds: {}", source, answer);
return answer;
}
(camel) 01/02: CAMEL-22337: camel-jbang debug for camel quarkus
Posted by da...@apache.org.
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.git
commit 3d0ae34facef183c3fafc70fd792e1ce06cee873
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Aug 31 10:11:04 2025 +0200
CAMEL-22337: camel-jbang debug for camel quarkus
---
.../camel/dsl/jbang/core/commands/Debug.java | 120 ++++++++++++++++++++-
1 file changed, 118 insertions(+), 2 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
index dc07f0d36cc..11eb406c9b8 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
@@ -263,14 +263,14 @@ public class Debug extends Run {
@Override
protected int runDebug(KameletMain main) throws Exception {
- // is this a maven project
File pom = new File("pom.xml");
if (pom.isFile() && pom.exists()) {
- // is this a spring-boot project
try (InputStream is = new FileInputStream(pom)) {
String text = IOHelper.loadText(is);
if (text.contains("camel-spring-boot-bom")) {
return doRunDebugSpringBoot(main);
+ } else if (text.contains("org.apache.camel.quarkus")) {
+ return doRunDebugQuarkus(main);
}
}
}
@@ -393,6 +393,122 @@ public class Debug extends Run {
return 0;
}
+ private int doRunDebugQuarkus(KameletMain main) throws Exception {
+ Path pom = Paths.get("pom.xml");
+ MavenXpp3Reader mavenReader = new MavenXpp3Reader();
+ try (Reader reader = Files.newBufferedReader(pom)) {
+ Model model = mavenReader.read(reader);
+
+ // include camel-debug dependency
+ Dependency d = new Dependency();
+ d.setGroupId("org.apache.camel.quarkus");
+ d.setArtifactId("camel-quarkus-debug");
+ model.getDependencies().add(d);
+ d = new Dependency();
+ d.setGroupId("org.apache.camel.quarkus");
+ d.setArtifactId("camel-quarkus-cli-connector");
+ model.getDependencies().add(d);
+
+ Profile mp = new Profile();
+ model.addProfile(mp);
+ mp.setId("camel-debug");
+ Activation a = new Activation();
+ a.setActiveByDefault(true);
+ mp.setActivation(a);
+
+ Build b = new Build();
+ mp.setBuild(b);
+
+ Plugin pi = new Plugin();
+ b.addPlugin(pi);
+ pi.setGroupId(quarkusGroupId);
+ pi.setArtifactId("quarkus-maven-plugin");
+ pi.setVersion(quarkusVersion);
+ PluginExecution pe = new PluginExecution();
+ pe.addGoal("build");
+ pi.addExecution(pe);
+ Xpp3Dom cfg = new Xpp3Dom("finalName");
+ cfg.setValue("camel-jbang-debug");
+ Xpp3Dom root = new Xpp3Dom("configuration");
+ root.addChild(cfg);
+ pi.setConfiguration(root);
+
+ MavenXpp3Writer w = new MavenXpp3Writer();
+ FileOutputStream fos = new FileOutputStream("camel-jbang-debug-pom.xml", false);
+ w.write(fos, model);
+ IOHelper.close(fos);
+
+ printer().println("Preparing Camel Quarkus for debugging ...");
+
+ // use maven wrapper if present
+ String mvnw = "/mvnw";
+ if (FileUtil.isWindows()) {
+ mvnw = "/mvnw.cmd";
+ }
+ if (!new File(mvnw).exists()) {
+ mvnw = "mvn";
+ }
+ // use maven to build the JAR and then run the JAR after-wards
+ ProcessBuilder pb = new ProcessBuilder();
+ pb.command(mvnw, "-Dmaven.test.skip", "--file", "camel-jbang-debug-pom.xml", "package", "quarkus:build");
+ Process p = pb.start();
+
+ if (p.waitFor(30, TimeUnit.SECONDS)) {
+ AtomicReference<Process> processRef = new AtomicReference<>();
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ try {
+ // We need to wait for the process to exit before doing any cleanup
+ Process process = processRef.get();
+ if (process != null) {
+ process.destroy();
+ for (int i = 0; i < 30; i++) {
+ if (!process.isAlive()) {
+ break;
+ }
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ removeDir(Paths.get(RUN_PLATFORM_DIR));
+ removeDir(Paths.get(CAMEL_JBANG_WORK_DIR));
+ Files.deleteIfExists(Paths.get("camel-jbang-debug-pom.xml"));
+ } catch (Exception e) {
+ // Ignore
+ }
+ }));
+
+ // okay build is complete then run java
+ pb = new ProcessBuilder();
+ pb.command("java",
+ "-Dcamel.debug.enabled=true",
+ (breakpoint == null
+ ? "-Dcamel.debug.breakpoints=_all_routes_" : "-Dcamel.debug.breakpoints=" + breakpoint),
+ "-Dcamel.debug.loggingLevel=DEBUG",
+ "-Dcamel.debug.singleStepIncludeStartEnd=true",
+ "-Dcamel.main.sourceLocationEnabled=true",
+ "-jar", "target/quarkus-app/quarkus-run.jar");
+
+ p = pb.start();
+ processRef.set(p);
+ this.spawnOutput = p.getInputStream();
+ this.spawnError = p.getErrorStream();
+ this.spawnPid = p.pid();
+ printer().println("Debugging Camel Quarkus integration: " + name + " with PID: " + p.pid());
+ } else {
+ printer().printErr("Timed out preparing Camel Quarkus for debugging");
+ this.spawnError = p.getErrorStream();
+ this.spawnPid = p.pid();
+ p.destroy();
+ return -1;
+ }
+ }
+
+ return 0;
+ }
+
protected int doRunDebug(KameletMain main) throws Exception {
List<String> cmds = new ArrayList<>(spec.commandLine().getParseResult().originalArgs());