allthingssecurity opened a new pull request, #27121: URL: https://github.com/apache/camel/pull/27121
# Description [CAMEL-25165](https://issues.apache.org/jira/browse/CAMEL-25165) `SpringRedisIdempotentRepository.remove` returns `setOperations.remove(repositoryName, key) != null`. `SREM` returns the number of members it removed, 0 when the key was not in the set, so `remove` returns true for any key. `IdempotentRepository.remove` documents "true if the key was removed". This change: return true only when `SREM` removed the key (`removed != null && removed > 0`), the same as the `add` fix in #27110 (CAMEL-25155). Claus Ibsen suggested it in the review of #27110. Inside a pipeline or a transaction, Spring Data Redis returns null, and `remove` returns false there as before. The Idempotent Consumer EIP and the file consumers call `remove` on failure and do not use the returned value, so they are not affected. Code that calls the repository directly, and the JMX `remove` operation, now get false for a missing key. The upgrade guide for 4.23 gets a two-line note for that. Tests: - `SpringRedisIdempotentRepositoryTest` (mocked `SetOperations`, as in the existing tests) gets three new tests: `SREM` returns 1 gives true, 0 gives false, null gives false. - Without the change, `shouldReturnFalseWhenKeyIsNotInTheSet` fails (`expected: <false> but was: <true>`). - With the change, all camel-spring-redis tests pass: 126 tests, 0 failures. # 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 module, 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). 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]
