allthingssecurity opened a new pull request, #27292: URL: https://github.com/apache/camel/pull/27292
# Description [CAMEL-25272](https://issues.apache.org/jira/browse/CAMEL-25272) Two places where camel-rocketmq reports a failure as success: - **Consumer.** `RocketMQConsumer`'s listener answered `CONSUME_SUCCESS` whenever the processor returned, and `RECONSUME_LATER` only when it threw. A failing route does not throw: the error handler sets the exception on the exchange. So the message of every failed exchange was acknowledged and lost (no retry topic, no dead letter queue). - **Producer.** An InOut exchange (for example from an HTTP consumer) sent without `replyToTopic` has no reply manager; when the asynchronous send failed, `onException` dereferenced the `null` reply manager, the `NullPointerException` skipped `exchange.setException(e)`, and the exchange completed as if the message had been sent. This change: the listener (now a package-private method, so that it can be tested without a broker) sets a thrown exception on the exchange and answers `RECONSUME_LATER` whenever the exchange has an exception, after reporting it to the exception handler; the producer sets the exception first and cancels the message key only when there is a reply manager. The upgrade guide for 4.23 gets a note: messages of failed exchanges are now consumed again (with an increasing delay, up to the max reconsume times of the consumer group, 16 by default, then the dead letter queue). Tests: - `RocketMQConsumerFailureTest` (new, 3 tests): a route that throws (`RECONSUME_LATER`), a processor that throws, and a successful route (`CONSUME_SUCCESS`). - `RocketMQProducerSendFailureTest` (new, 2 tests): an empty body, which the RocketMQ client rejects in its asynchronous send before it contacts the name server (`MQClientException`), InOnly and InOut without `replyToTopic`. - Without the change 2 fail: `expected: <RECONSUME_LATER> but was: <CONSUME_SUCCESS>`, and no exception for the InOut send. - With the change the 5 tests pass. The other tests of the module are ITs that need Docker (not run). The module skips its tests on aarch64 (`skipTests.aarch64`, the RocketMQ container is x86 only), so I ran these with `-DskipTests.aarch64=false -DskipTests=false`; on the x86 CI they run normally. # 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]
