davsclaus commented on code in PR #23868:
URL: https://github.com/apache/camel/pull/23868#discussion_r3380331482


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java:
##########
@@ -1975,22 +1997,63 @@ private void startMissingInfraAndDeferExample(
         setNotification("Starting infra: " + infraList + " → then: " + 
displayName, false);
     }
 
+    private void startMissingInfraAndDeferFolder(String folder, String 
displayName, List<String> extraArgs) {
+        List<String> missingInfra = List.of("jaeger");
+        for (String alias : missingInfra) {
+            try {
+                List<String> cmd = new 
ArrayList<>(LauncherHelper.getCamelCommand());
+                cmd.add("infra");
+                cmd.add("run");
+                cmd.add(alias);
+                cmd.add("--background");
+                Path outputFile = Files.createTempFile("camel-infra-", ".log");
+                outputFile.toFile().deleteOnExit();
+                ProcessBuilder pb = new ProcessBuilder(cmd);
+                pb.redirectErrorStream(true);
+                pb.redirectOutput(outputFile.toFile());
+                Process process = pb.start();
+                pendingLaunches.add(new PendingLaunch(alias, process, 
outputFile, System.currentTimeMillis()));
+            } catch (Exception e) {
+                setNotification("Failed to start infra: " + alias + " - " + 
e.getMessage(), true);
+                return;
+            }
+        }
+        deferredFolderLaunch = new DeferredFolderLaunch(
+                folder, displayName, extraArgs, missingInfra, 
System.currentTimeMillis());
+        infraCatalog = null;
+        setNotification("Starting infra: jaeger → then: " + displayName, 
false);
+    }
+
     private void checkDeferredLaunch(long now) {
-        if (deferredLaunch == null) {
-            return;
+        if (deferredLaunch != null) {
+            Set<String> runningAliases = infraServices.get().stream()
+                    .filter(i -> i.alive)
+                    .map(i -> i.alias)
+                    .collect(Collectors.toSet());
+            boolean allReady = 
runningAliases.containsAll(deferredLaunch.requiredInfra);
+            if (allReady) {
+                DeferredExampleLaunch dl = deferredLaunch;
+                deferredLaunch = null;
+                doLaunchExample(dl.exampleName, dl.displayName, dl.extraArgs);
+            } else if (now - deferredLaunch.startTime > 120_000) {
+                deferredLaunch = null;

Review Comment:
   This method is a near-copy of `startMissingInfraAndDeferExample()` above. 
The only differences are the parameter types and the `DeferredFolderLaunch` 
record vs `DeferredExampleLaunch`. A shared abstraction (common record 
interface or parameterized method) would reduce duplication.
   
   Similarly, `checkDeferredLaunch()` now has two nearly identical if-blocks. 
Consider extracting a generic check-and-launch helper.



##########
components/camel-opentelemetry2/pom.xml:
##########
@@ -54,10 +54,19 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-telemetry</artifactId>
         </dependency>
+        <dependency>

Review Comment:
   Adding `camel-core-model` as a runtime dependency couples the telemetry 
component to the model layer. This is needed for `RouteBuilder` in 
`initOtlpReceiver()`. Since the receiver is dev-only and agent-specific, the 
coupling is limited in practice — but worth noting for future reference.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to