gnodet commented on code in PR #24698:
URL: https://github.com/apache/camel/pull/24698#discussion_r3602203125


##########
core/camel-core/src/test/java/org/apache/camel/component/direct/DirectProducerBlockingTest.java:
##########
@@ -98,8 +100,10 @@ public void run() {
             }
         });
 
-        // This call will block until the route is resumed by the background 
thread
-        template.sendBody("direct:suspended?block=true&timeout=2000", "hello 
world");
+        // This call will block until the route is resumed by the background 
thread.
+        // Use a generous timeout so the background thread has enough headroom 
to
+        // detect the TIMED_WAITING state and resume the route even under CI 
load.
+        template.sendBody("direct:suspended?block=true&timeout=10000", "hello 
world");

Review Comment:
   _Claude Code on behalf of gnodet_
   
   The `DirectConsumerNotAvailableException` IS the manifestation of the 
timeout expiring. Here is the sequence:
   
   1. `template.sendBody("direct:suspended?block=true&timeout=2000", ...)` 
blocks in `DirectComponent.getConsumer()`, waiting for a consumer to become 
available (the route is suspended)
   2. A background thread uses Awaitility to wait until the main thread enters 
`TIMED_WAITING` state, then calls `context.resumeRoute("suspended")`
   3. If step 2 takes longer than the `timeout=2000` parameter, the 
`getConsumer()` call times out and throws `DirectConsumerNotAvailableException` 
— because the route was not resumed in time
   
   So the "no consumer available" error IS the timeout — the consumer never 
became available within the 2s window. On slow CI, the background thread's 
`await().atMost(2s)` can itself expire or the `resumeRoute()` can take long 
enough that the 2s `sendBody` timeout is exhausted.
   
   The fix raises both timeouts (background Awaitility and sendBody) from 2s to 
10s, giving CI enough headroom. The test logic remains identical — it still 
verifies that `block=true` correctly waits for a suspended route to resume.



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