Jinyu Chen created CAMEL-23772:
----------------------------------

             Summary: dataformat: endpoints ignore global camel.dataformat.* 
configuration in camel quarkus
                 Key: CAMEL-23772
                 URL: https://issues.apache.org/jira/browse/CAMEL-23772
             Project: Camel
          Issue Type: Improvement
            Reporter: Jinyu Chen


During analysing issue [https://github.com/apache/camel-quarkus/issues/7651]
Found Problem might caused by Camel: 
Routes using dataformat: endpoints do not apply global camel.dataformat.* 
configuration from application.properties in CEQ.

application.properties:
_camel.dataformat.beanio.stream-name=employee-stream  
camel.dataformat.beanio.mapping=employee-mapping.xml_

This works (I think it's what CAMEL-22352 proposed to do)
  _from("direct:test1")_
      _.unmarshal().beanio("mapping.xml", "stream");_  // Uses global config

This fails
  _from("direct:test2")_
      _.to("dataformat:beanio:unmarshal");_ Ignores global config and throw 
error IllegalArgumentException: Stream name not configured.



After initial analyze, the root cause probably is 
DataFormatComponent.createEndpoint() calls createDataFormat() which always 
creates a new unconfigured instance. It never reaches the fallback 
resolveDataFormat() that would return the configured template.

CAMEL-22352 fixed this for DataFormatReifier, but DataFormatComponent uses a 
different code path.

Proposed Solutions:
 * Option 1 (safer): Add copyConfigurationFromTemplate() to 
DataFormatComponent, similar to CAMEL-22352's fix in 
DataFormatReifier.configureDataFormat()
 * Option 2 (wider impact): Add configuration copy in 
AbstractCamelContext.createDataFormat() to benefit all creation paths



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to