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

   _Claude Code on behalf of davsclaus_
   
   ## Summary
   
   Fixes a bug where `AsyncCallback.done()` is invoked twice when a JMS send 
fails after the reply correlation has been registered in 
`JmsProducer.processInOut`.
   
   **Root cause:** `replyManager.registerReply()` runs inside 
`MessageCreator.createMessage()` (before the actual JMS send). If the send 
fails (broker quota, max message size, connection drop), the exception path 
completes the exchange via `callback.done(true)`, but the reply handler stays 
registered in the `CorrelationTimeoutMap`. At `requestTimeout` (default 20s), 
the eviction fires `onTimeout` → `processReply`, which sets 
`ExchangeTimedOutException` on the already-completed exchange and invokes 
`callback.done(false)` a second time.
   
   **Fix:**
   - Add `cancelCorrelationId(String)` to `ReplyManager` interface — removes a 
pending reply handler from the correlation map without invoking the callback
   - Implement in `ReplyManagerSupport`
   - Wrap `doSend()` in `JmsProducer.processInOut` with try/catch to cancel the 
registered correlation on send failure before re-throwing
   
   ## Test plan
   
   - [x] New test `JmsInOutSendFailureCallbackTest` — uses a proxied 
`ConnectionFactory` that makes `MessageProducer.send()` throw, verifies the 
exchange exception remains the original JMS send failure and is not overwritten 
by `ExchangeTimedOutException` after the request timeout elapses
   - [ ] CI passes
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   Co-Authored-By: Claude Opus 4.6 <[email protected]>


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