JinyuChen97 commented on issue #7651:
URL: https://github.com/apache/camel-quarkus/issues/7651#issuecomment-4708813677
Hi @jamesnetherton, for this issue, after initial investigation, I guess the
issue happened caused by the definition in Beanio routes
```
from("direct:unmarshalGlobal")
.to("dataformat:beanio:unmarshal");
```
As this route definition directly trigger dataformat component, the code in
DataFormatComponent is
```
@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
String operation = StringHelper.after(remaining, ":");
if (!"marshal".equals(operation) && !"unmarshal".equals(operation)) {
throw new IllegalArgumentException("Operation must be either
marshal or unmarshal, was: " + operation);
}
// create new data format as it is configured from the given
parameters
String name = StringHelper.before(remaining, ":");
DataFormat df = getCamelContext().createDataFormat(name); //**even
BaseMainSupport has initialized template instance with configuration, but this
line will create a beanio instance without any properties**
if (df == null) {**//workflow will not process to this code block.**
// if not, try to lookup existing data format
df = getCamelContext().resolveDataFormat(name);
}
if (df == null) {
throw new IllegalArgumentException("Cannot find data format with
name: " + name);
}
// find configurer if any
PropertyConfigurer configurer =
PluginHelper.getConfigurerResolver(getCamelContext())
.resolvePropertyConfigurer(name + "-dataformat",
getCamelContext());
// bind properties to data format
PropertyBindingSupport.Builder builder = new
PropertyBindingSupport.Builder();
builder.withConfigurer(configurer);
builder.bind(getCamelContext(), df, parameters);
// create endpoint
DataFormatEndpoint endpoint = new DataFormatEndpoint(uri, this, df);
endpoint.setOperation(operation);
setProperties(endpoint, parameters);
return endpoint;
}
```
Then dataformatendpoint will be created with this empty configuration and
failed until triggered BeanIODataFormat.doInit().
the CamelQuarkusDataFormatConfigLifecycleStrategy is useful for applying the
config when create data format by:
```
for (LifecycleStrategy strategy : lifecycleStrategies) {
strategy.onDataFormatCreated(name, answer);
}
```
Please correct me if im wrong.
If we need to remove CamelQuarkusDataFormatConfigLifecycleStrategy, I guess
we will need to update the camel-dataformat in camel to support this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]