allthingssecurity commented on code in PR #30313:
URL: https://github.com/apache/camel/pull/30313#discussion_r4611778763


##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/debugger/DefaultBacklogDebugger.java:
##########
@@ -1154,6 +1134,85 @@ public void onEvent(Exchange exchange, ExchangeEvent 
event, NamedNode definition
             }
         }
 
+        /**
+         * Suspends the single-stepped exchange at the node, and waits until 
it should continue. Another exchange may be
+         * suspended at the node by a node breakpoint: the step then waits 
until that exchange is no longer suspended
+         * there, as the debugger keeps one suspended exchange per node, and 
must not replace the other exchange.
+         */
+        private void suspendStep(String toNode, Exchange exchange, 
BacklogTracerEventMessage msg) {
+            String exchangeId = exchange.getExchangeId();
+            SuspendedExchange se = new SuspendedExchange(exchange);
+            try {
+                if (!awaitNode(toNode, se)) {
+                    return;
+                }
+                // publish the message only while this exchange is the one 
suspended at the node
+                suspendedBreakpointMessages.compute(toNode, (k, m) -> 
suspendedBreakpoints.get(k) == se ? msg : m);
+
+                // now wait until we should continue
+                logger.log(
+                        String.format("StepBreakpoint at node %s is waiting to 
continue for exchangeId: %s", toNode,
+                                exchangeId));
+                boolean hit = se.awaitExchange(fallbackTimeout);
+                if (!hit) {
+                    // remove breakpoint as it timed out (only the ones of 
this exchange)
+                    removeMessageOf(toNode, exchangeId);
+                    suspendedBreakpoints.remove(toNode, se);
+                    logger.log(
+                            String.format("StepBreakpoint at node %s timed out 
and is continued exchangeId: %s", toNode,
+                                    exchangeId),
+                            LoggingLevel.WARN);
+                } else {

Review Comment:
   I kept the two waits separate on purpose: the wait at the node is the time 
the user has to look at the exchange there. If the wait for the node had used 
most of the fallback timeout, the exchange would continue right after it shows 
up at the node. The javadoc of `suspendStep` now says the total can reach twice 
the fallback timeout (6cad04c).
   
   _Claude Code on behalf of allthingssecurity_



-- 
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