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

   ## Summary
   
   _Claude Code on behalf of gnodet_
   
   Fix the intermittently failing `NatsConsumerWithRedeliveryIT.testConsumer` 
test (CAMEL-23886).
   
   **Root cause:** `NatsConsumer.doStart()` submits the subscription task 
asynchronously via `executor.submit()`. On slow CI machines, messages sent to 
NATS can arrive before the consumer subscription is active. Since core NATS 
does not persist messages for inactive subscribers, those messages are silently 
lost — causing `mock:exception` to receive 0 messages instead of 1.
   
   **Evidence from Develocity:** The test showed 6 flaky runs out of 231 total 
CI builds (~2.6% failure rate) over the past 2 weeks. A prior fix (CAMEL-23884) 
improved assertion timing but did not address this root cause.
   
   **Changes:**
   - Wait for the `NatsConsumer` to be active (subscription established) before 
sending any messages, using Awaitility to poll `NatsConsumer.isActive()`
   - Replace Awaitility-based assertion with 
`MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS)` which is 
latch-based (more efficient than polling)
   
   ## Test plan
   
   - [x] Code compiles successfully
   - [x] Formatting and import sort checks pass
   - [ ] CI integration test passes (requires Docker/Testcontainers)
   - [ ] Monitor CI for flaky test recurrence after merge
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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