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

   # Description
   
   [CAMEL-26605](https://issues.apache.org/jira/browse/CAMEL-26605)
   
   `SedaPollingConsumer.receive()` was a plain `take()` on the queue. It did 
not look at the state of the polling consumer, so a thread that waited in it 
for a message waited for ever once nothing would put one there:
   - `consumerTemplate.receive("seda:foo")` (no timeout) in a worker thread, 
then the CamelContext stops. `SedaComponent.doStop` clears its queues, so even 
after a restart the thread waits on the old queue;
   - `consumerTemplate.stop()` while a `receive()` waits;
   - `pollEnrich("seda:foo")` with the default timeout: the forced stop of the 
route stops the polling consumer, but the exchange thread stays in `take()`.
   
   `EventDrivenPollingConsumer`, used by most other endpoints, checks every 
second while it waits whether it may still run and returns `null` once it is 
stopped (CAMEL-25036 is the same scenario for that class; seda has its own 
polling consumer).
   
   Change (`SedaPollingConsumer`): `receive()` waits with `poll(1 s)` in a loop 
and returns `null` once the polling consumer is stopping, stopped or shut down 
(the CamelContext stop, the consumer template stop and the `pollEnrich` stop 
all stop it; so does an eviction from the consumer cache). A message already in 
the queue is still returned. A polling consumer that was never started keeps 
waiting, as before (code that calls 
`endpoint.createPollingConsumer().receive()` without starting it still works). 
`receive(timeout)` and `receiveNoWait()` are unchanged. Upgrade guide 4.24 
entry added, since a caller now gets `null` where it waited before. Main only 
(a visible behaviour change, so no backport).
   
   Tests: `SedaPollingConsumerStopTest` (CamelContext stop, consumer template 
stop, `pollEnrich` route stop while `receive()` waits; control: a polling 
consumer that was never started still gets the next message). On main the three 
stop tests fail (the call does not return within 10 s) and the control passes; 
with the fix 4/4, and 80/80 over 20 runs. camel-core seda, pollEnrich, consumer 
template and polling consumer tests and the camel-stub tests: 240 run, 0 
failures apart from 
`SedaConfigureTest.testConfigureIgnoreCaseLocaleIndependent`, which fails 
because my local camel-package-maven-plugin is older than CAMEL-26439 and 
regenerated the configurers (not part of this change).
   
   # 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): 
[CAMEL-26605](https://issues.apache.org/jira/browse/CAMEL-26605).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built the core modules, camel-seda and camel-core with the formatter 
and import-sort plugins and ran the related camel-core tests; no generated file 
changes. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 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