apupier commented on code in PR #31007:
URL: https://github.com/apache/camel/pull/31007#discussion_r4720250220


##########
components/camel-pulsar/src/test/java/org/apache/camel/component/pulsar/integration/PulsarSuspendRouteIT.java:
##########
@@ -151,8 +158,21 @@ public void configure() {
 
         producer.send("test");
 
-        context.getRouteController().suspendRoute(ROUTE_ID);
+        // suspend only once the exchange is in-flight. suspendRoute blocks 
until the in-flight exchange completes,
+        // so it runs in another thread. The processor is released only after 
the consumer is suspended, which is
+        // what the shutdown strategy does before it waits for the in-flight 
exchange
+        assertTrue(exchangeInFlight.await(30, TimeUnit.SECONDS));
+        Consumer consumer = context.getRoute(ROUTE_ID).getConsumer();
+        CompletableFuture<Void> suspension = CompletableFuture.runAsync(() -> {
+            try {
+                context.getRouteController().suspendRoute(ROUTE_ID);
+            } catch (Exception e) {
+                throw new RuntimeException(e);

Review Comment:
   Good catch, thanks. Both points are right and are fixed in 0b896cfc73: the 
test now waits for `SuspendableService.isSuspended()` before releasing the 
processor, which makes the ordering explicit. The root cause in the PR/commit 
was wrong, so I rewrote it: the 2s processor await timing out while 
`suspendRoute` blocked, as you describe. The test now passes 4/4 locally. _IBM 
Bob on behalf of Aurélien Pupier_



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