Federico Mariani created CAMEL-23981:
----------------------------------------
Summary: camel-yaml-dsl - springTransactionErrorHandler constructs
JtaTransactionErrorHandlerDefinition instead of
SpringTransactionErrorHandlerDefinition
Key: CAMEL-23981
URL: https://issues.apache.org/jira/browse/CAMEL-23981
Project: Camel
Issue Type: Bug
Components: camel-yaml-dsl
Affects Versions: 4.21.0
Reporter: Federico Mariani
In {{ErrorHandlerDeserializer}}
({{dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/main/java/org/apache/camel/dsl/yaml/deserializers/ErrorHandlerDeserializer.java}},
lines 112-114) both keys fall into the same switch case:
{code:java}
case "jtaTransactionErrorHandler":
case "springTransactionErrorHandler":
factory = asType(val, JtaTransactionErrorHandlerDefinition.class);
break;
{code}
However the {{@YamlProperty}} annotation on the same class (lines 68-70)
declares {{springTransactionErrorHandler}} as
{{object:org.apache.camel.model.errorhandler.SpringTransactionErrorHandlerDefinition}},
that class exists in camel-core-model, and camel-spring registers its
error-handler reifier for exactly that class
({{SpringTransactionPolicy.java:54}}).
{{ErrorHandlerReifier.reifier()}} looks up reifiers by *exact* definition class
({{ERROR_HANDLERS.get(definition.getClass())}}) and the core fallback only
covers deadLetterChannel/default/no/ref. Consequences of the YAML DSL producing
the JTA definition:
* Spring application without camel-jta: startup fails with
{{IllegalStateException: Unsupported definition}} (only camel-spring registered
a reifier, but for the Spring definition class).
* camel-jta present: silently uses JTA transaction semantics instead of the
Spring transaction manager the user asked for.
The case merge was introduced by CAMEL-20568 ({{c0228d4f12c6}}) with no comment
justifying it, and there is no YAML test covering
{{springTransactionErrorHandler}}.
Fix: split the case and construct {{SpringTransactionErrorHandlerDefinition}}
for the {{springTransactionErrorHandler}} key; add a YAML test.
_Filed by Claude Code on behalf of Croway._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)