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

   ## Description
   
   Fixes the flaky `JettyJmsShutdownTest` (CAMEL-26368).
   
   **Cause:** the test did `Thread.sleep(1000)` and then `camelContext.stop()`, 
assuming the 3 asynchronous HTTP requests had all reached the JMS consumer 
route. On a slow machine this is not guaranteed, so the shutdown could overtake 
requests still in flight, resulting in HTTP 500 (or the producer template being 
stopped).
   
   **Fix:**
   - replace the `Thread.sleep` with a `NotifyBuilder` waiting (max 30s) until 
the consumer route has received the 3 messages
   - give the consumer route a specific id (`JettyJmsShutdownTest-consumer`) so 
it can be targeted without clashing with other tests
   
   **Verification:** adding an artificial `<delay>` of 1000/1300/2000 ms in the 
Jetty route of the original test makes it fail (`RejectedExecutionException: 
ProducerTemplate is not started`), whereas the fixed test passes with 1300 and 
2000 ms delays and without delay.
   
   ## Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   ## Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   ---
   _Bob (IBM Bob 2.2.1) on behalf of apupier_


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