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

   # Description
   
   [CAMEL-24954](https://issues.apache.org/jira/browse/CAMEL-24954)
   
   `IdempotentConsumer.doStop()` stopped the idempotent repository, and the 
in-memory repositories clear their data when stopped. 
`MemoryKeyValueRepository` clears the whole store, not just the `idempotent:` 
entries. So stopping one route silently wiped a repository that other running 
routes still used. With the 4.23 auto-discovered `KeyValueRepository` bean, it 
also wiped the Aggregate EIP's in-progress groups. `CacheProcessor.doStop()` 
(the Cache EIP, new in 4.23) had the same pattern.
   
   This change:
   - `IdempotentConsumer.doStop()` and `CacheProcessor.doStop()` no longer stop 
the repository. `doShutdown` is unchanged, so the repository is still stopped 
and shut down when the route is removed or CamelContext stops (CAMEL-9569). 
This matches what `AggregateProcessor` and `GenericFileEndpoint` already do.
   - 4.23 upgrade guide: a route that is stopped and started again now keeps 
the ids in its in-memory idempotent repository, and a remote repository stays 
connected while the route is stopped.
   
   Tests: new `IdempotentConsumerSharedRepositoryStopTest`, 7 tests:
   - shared `MemoryIdempotentRepository` and `KeyValueIdempotentRepository`;
   - an auto-discovered `MemoryKeyValueRepository` shared by two idempotent 
consumers and an aggregator, and one shared by an idempotent consumer and the 
Cache EIP;
   - a route restart;
   - lifecycle checks that removing the route and stopping CamelContext still 
stop the repository.
   
   Without the fix, 6 of the 7 fail, for example `The repository shared with 
route a must not be cleared` and `mock://agg Received message count. Expected: 
<1> but was: <0>`. The CamelContext stop check passes either way. With the fix: 
`*Idempotent*`, `KeyValue*`, `Cache*` and `*Aggregat*`, 43 + 335 tests, 0 
failures.
   
   Not changed here (noted on the JIRA ticket as follow-ups): removing one of 
several routes that share an in-memory repository still clears it (the 
CAMEL-9569 trade-off), and the key-value adapters stop a store they don't own.
   
   Found with a TLA+ model of the Idempotent Consumer, then reproduced against 
the real classes.
   
   # 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).
   
   # 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 and tested the affected modules, including the formatter and 
import-sort plugins. 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), on behalf of 
allthingssecurity. The commits carry a `Co-Authored-By` trailer.
   
   🤖 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