davsclaus opened a new pull request, #26980: URL: https://github.com/apache/camel/pull/26980
# Description [CAMEL-25082](https://issues.apache.org/jira/browse/CAMEL-25082), found in the review of CAMEL-25038 (#26913). On a request/reply timeout `DisruptorProducer` set `DisruptorEndpoint.DISRUPTOR_IGNORE_EXCHANGE` on the **caller's** exchange, not on the copy it had published into the ring buffer. `DisruptorConsumer` ignores any exchange that has the property (`containsKey`, whatever its value). So: - a timed out copy that the consumer had not started yet was still processed (the property never reached it); - every later copy of the caller's exchange inherited the property (`prepareCopy` copies the properties) and was dropped by the consumer, with only a TRACE log: - a redelivery by the error handler after the timeout was dropped and timed out again, so the redeliveries could never succeed; - a fallback to another disruptor endpoint, e.g. `doCatch(ExchangeTimedOutException.class).to("disruptor:fallback")`, was dropped: an InOnly message was lost silently, an InOut one timed out again. ## Change - The producer puts its `completed` flag (the `AtomicBoolean` that the reply, the timeout and the interrupt already claim since CAMEL-25038) on the published copy before it publishes it. The consumer ignores the copy only when the producer no longer waits for it, which now also covers an interrupted wait. The property is set before publishing, so the property map is not changed while the consumer reads it; only the `AtomicBoolean` changes afterwards. - The flag stays out of the routed exchange (the consumer removes it from its copy), is not copied back into the caller's exchange with the reply (`copyResults` copies the properties), and is not inherited by a new copy of the caller's exchange. - `DisruptorConsumer` and the reconfiguration buffer in `DisruptorReference` check the value of the flag through `DisruptorEndpoint.isIgnoreExchange`. - Upgrade guide 4.23: a paragraph in the existing camel-disruptor request/reply entry. ## Compared with camel-seda camel-seda is not affected: on a timeout (and on an interrupt) `SedaProducer` removes the timed out copy from its queue (`endpoint.getQueue().remove(copy)`) and does not mark the caller's exchange. ## Tests New `DisruptorTimeoutIgnoreExchangeTest`: - a redelivery after a timeout is processed and gets the reply; - an InOnly fallback to another disruptor endpoint after a timeout is delivered; - a timed out exchange that the consumer had not started is not processed; - a successful reply does not leave the flag on the caller's exchange, and a following InOnly send is delivered. Without the main-code change the first three fail (`CamelExecutionException` from the timed out redeliveries, `mock://fallback ... Expected: <1> but was: <0>`, `mock://busy ... Expected: <1> but was: <2>`). With it, the whole camel-disruptor suite passes (110 tests). _Claude Code on behalf of davsclaus_ 🤖 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]
