[ 
https://issues.apache.org/jira/browse/CAMEL-27285?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-27285.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/30532 (merged as 4c0545db8260).

_Claude Code on behalf of davsclaus_

> camel-spring - after a nested PROPAGATION_REQUIRES_NEW route of the same 
> policy, the rest of the calling route runs as not transacted
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27285
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27285
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-spring
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>             Fix For: 4.24.0
>
>
> h3. What happens
> Route A {{transacted("PROPAGATION_REQUIRES_NEW")}} calls route B 
> {{transacted("PROPAGATION_REQUIRES_NEW")}} (the same policy bean) with 
> {{to("direct:b")}}. Since CAMEL-8424 the {{TransactionErrorHandler}} of B 
> starts a new transaction there. Its {{processInTransaction}} calls 
> {{beginTransactedBy(key)}} and {{endTransactedBy(key)}} with the same key as 
> A; the unit of work keeps the keys in a Set, so when B ends it removes A's 
> key, and {{exchange.isTransacted()}} becomes false for the rest of route A, 
> which still runs in A's transaction.
> The EIPs that run a step synchronously only for a transacted exchange then 
> hand the message to another thread, outside the thread-bound Spring 
> transaction: the Delay EIP (asyncDelayed is the default), Throttle, Threads, 
> a delayed redelivery (asyncDelayedRedelivery). The steps that run there are 
> not part of A's transaction: a database insert is committed on its own and 
> stays when A rolls back.
> h3. How to reproduce
> {{TransactionErrorHandlerNestedRequiresNewTest}} (camel-spring, a small 
> {{AbstractPlatformTransactionManager}} that records its transactions and 
> supports suspend/resume): A calls B (same REQUIRES_NEW policy), then 
> {{delay(1)}} and a step that records the transaction it runs in. 
> {{exchange.isTransacted()}} is false after B, and the step after the delay 
> runs on a scheduler thread without a transaction, so it is not rolled back 
> with A.
> h3. Fix
> {{processInTransaction}} marks and unmarks the unit of work only when the key 
> was not marked yet.
> _Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to