[
https://issues.apache.org/jira/browse/CAMEL-26953?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26953 started by shashank.
----------------------------------------
> camel-core - SendProcessor, the sync send of the producer cache and the send
> hook: a producer that calls the callback and then throws completes the
> exchange twice
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26953
> URL: https://issues.apache.org/jira/browse/CAMEL-26953
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Reporter: shashank
> Assignee: shashank
> Priority: Minor
>
> Follow-up of CAMEL-26882, named in its PR (#29786) and asked for in its
> review. The same rule as CAMEL-26445, CAMEL-26461, CAMEL-26464 and
> CAMEL-26882: the callback of an exchange is called exactly once, also when an
> {{AsyncProcessor}} breaks the async contract (calls the callback and then
> throws).
> CAMEL-26882 fixed this in {{DefaultProducerCache.doInAsyncProducer}}. Three
> places still do it the old way:
> * {{SendProcessor.sendUsingProducer}} (the optimised {{to}}): its catch sets
> the exception on the exchange and calls {{callback.done(true)}}. When the
> producer had already called the callback, the exchange has already been
> continued (maybe on another thread), the exception is set on it afterwards,
> and the callback is called a second time.
> * {{DefaultProducerCache.send}} (the sync send) also sets an exception thrown
> after the callback on the exchange.
> * {{SendHelper.HookedSend}} (with a send hook, which today only camel-chaos
> installs) sets such an exception on the exchange, and calls {{afterSend}} a
> second time, before it rethrows it. So with a hook, {{doInAsyncProducer}}
> completes the send once since CAMEL-26882, but the exception stays on the
> exchange.
> Also for the same follow-up (from #29786): the async sends of the producer
> template emit a sending/sent pair from both {{doInAsyncProducer}} and
> {{EventNotifierCallback}}, as before CAMEL-26882.
> Expected: as in {{DefaultProducerCache.doInAsyncProducer}} after CAMEL-26882,
> a throw after the callback is logged at WARN and not set on the exchange, and
> the exchange is completed once. {{SendProcessor}} is the hot path of {{to}},
> so the guard there should not add work to a normal send (CAMEL-26882 replaced
> a lambda with one small object per send).
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)