apupier opened a new pull request, #31007:
URL: https://github.com/apache/camel/pull/31007

   # Description
   
   `PulsarSuspendRouteIT.suspendRouteWithBuiltInAck` is flaky: it fails with 
`mock://result Received message count. Expected: <1> but was: <0>` (2 failures 
and about 35 flaky runs in the last 90 days on Develocity).
   
   **Root cause:** the test sent a message and called `suspendRoute` right 
away, without waiting for the consumer to start the exchange. If the route was 
suspended before the message was delivered, the exchange never ran, so the mock 
received 0 messages.
   
   **Fix (test-only, no production code changed):**
   - The processor counts down a latch when it receives the exchange. The test 
waits for that latch before suspending, so the suspension always happens while 
the exchange is in flight.
   - `suspendRoute` blocks until the in-flight exchange completes. It now runs 
in a `CompletableFuture`, and the processor is released after suspension has 
started. Without this, the processor waits on a latch that is only released 
after `suspendRoute` returns, and the test deadlocks until timeout.
   - All waits are bounded (30s for the latch and the future, 10s for the 
processor hold), replacing the previous 2s hold.
   
   **Timing:** `suspendRouteWithBuiltInAck` took 8.5s before and 10.0s after in 
a local run against a Testcontainers Pulsar broker. The difference is within 
run-to-run noise. The class passes 4/4.
   
   JIRA: [CAMEL-27554](https://issues.apache.org/jira/browse/CAMEL-27554)
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] I checked there is a [JIRA 
issue](https://issues.apache.org/jira/browse/CAMEL-27554) filed for the change.
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn formatter:format impsort:sort` on the `camel-pulsar` 
module. No auto-generated files are affected.
   
   # AI-assisted contributions
   
   - [x] This PR includes AI-generated code. The commit has a `Co-authored-by: 
IBM Bob 2.2.1` trailer. The change was produced by IBM Bob on behalf of 
Aurélien Pupier, who reviewed it.
   


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