shashank created CAMEL-26446:
--------------------------------
Summary: camel-core - RedeliveryErrorHandler: a throw on the first
delivery skips redelivery, the dead letter channel and onException, and can
continue the exchange twice
Key: CAMEL-26446
URL: https://issues.apache.org/jira/browse/CAMEL-26446
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26430 and CAMEL-26445 (the {{SimpleTask}} side), named in
both.
{{RedeliveryErrorHandler.RedeliveryTask.run()}} runs the first delivery of a
step whose error handler has redelivery, exception policies or a dead letter
channel. When the processor (such as an {{AsyncProcessor}}) throws from
{{process(exchange, callback)}} there, the catch of {{run()}} sets the
exception on the exchange, releases the task and calls the callback directly:
* so a throw on the first attempt is not redelivered, does not reach the dead
letter channel and is not handled by {{onException}}, while the same throw on a
redelivery goes through them since CAMEL-26430, and the same failure set on the
exchange by the processor goes through them too;
* the catch has no exactly-once guard: a processor that hands its callback to
another thread and then throws gets the exchange completed by the catch and
continued a second time by that callback (two completions; with pooled tasks
the late callback works on a reset task).
*Proposal*
Redelivery now loops back (CAMEL-26430), so the first delivery should be made
consistent with it. Handle a throw of the first delivery as CAMEL-26430 handles
one of a redelivery: take over through the reactive executor after the work
already queued there, with a flag shared with the callback of the processor,
set the exception and loop back to the error handler, so redelivery, the dead
letter channel and {{onException}} apply. CAMEL-24980 proposes to share the
failure handling of the tasks; this could be that step. Tests as in
{{RedeliveryProcessorThrowsTest}} for the first delivery, and a late callback
from another thread.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)