[
https://issues.apache.org/jira/browse/CAMEL-16552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Klug updated CAMEL-16552:
---------------------------------
Description:
In BaseMainSupport.java the route id to be used for routes instantiated based
on templates using properties seems to be determined by using square brackets
with non-number indices (see CAMEL-15270):
...
> String id = StringHelper.between(entry.getKey(), "[", "]"); ...
> source.addParameter(id, key, entry.getValue()); ...
>
I fear that may break compatibility with YAML formatted application
configuration files, or at least I can't figure out how to model it in YAML.
My attempts are shown in the two YAML excepts below, which will cause
"binding to target [Bindable@7af327e3 type =
java.util.List<java.util.Map<java.lang.String, java.lang.String>> failed".
The first example results in properties generated i. e.
camel.route-template.config[4][0].auto-start, as I can't get around the yaml
list.
1)
camel:
route-template:
config:
"[4]":
- template-id: "template-route"
...
2)
camel:
route-template:
config:
"[4]":
template-id: "template-route"
...
Pls. provide a possibility or an example to configure routes based on templates
in YAML.
Additional remark: I tried to set the route id in a route template definition
converter, however, in DefaultModel.java, the id is overwritten after the
converter is applied:
RouteDefinition def = converter.apply(target, prop);
if (routeId != null) {
def.setId(routeId);
}
Is that intended?
was:
In BaseMainSupport.java the route id to be used for routes instantiated based
on templates using properties seems to be determined by using square brackets
with non-number indices (see CAMEL-15270):
...
> String id = StringHelper.between(entry.getKey(), "[", "]"); ...
> source.addParameter(id, key, entry.getValue()); ...
>
I fear that may break compatibility with YAML formatted application
configuration files, or at least I can't figure out how to model it in YAML.
My attempts are shown in the two YAML excepts below, which will cause
"binding to target [Bindable@7af327e3 type =
java.util.List<java.util.Map<java.lang.String, java.lang.String>> failed".
The first example results in properties generated i. e.
camel.route-template.config[4][0].auto-start, as I can't get around the yaml
list.
1)
camel:
route-template:
config:
"[4]":
- template-id: "template-route"
...
2)
camel:
route-template:
config:
"[4]":
template-id: "template-route"
...
Pls. provide a possibility or an example to configure routes based on templates
in YAML.
> RouteId specification for property based-template instantiation breaking YAML
> compatibility?
> --------------------------------------------------------------------------------------------
>
> Key: CAMEL-16552
> URL: https://issues.apache.org/jira/browse/CAMEL-16552
> Project: Camel
> Issue Type: Improvement
> Components: camel-main
> Affects Versions: 3.7.3
> Reporter: Andreas Klug
> Priority: Minor
>
> In BaseMainSupport.java the route id to be used for routes instantiated based
> on templates using properties seems to be determined by using square brackets
> with non-number indices (see CAMEL-15270):
> ...
> > String id = StringHelper.between(entry.getKey(), "[", "]"); ...
> > source.addParameter(id, key, entry.getValue()); ...
> >
> I fear that may break compatibility with YAML formatted application
> configuration files, or at least I can't figure out how to model it in YAML.
> My attempts are shown in the two YAML excepts below, which will cause
> "binding to target [Bindable@7af327e3 type =
> java.util.List<java.util.Map<java.lang.String, java.lang.String>> failed".
> The first example results in properties generated i. e.
> camel.route-template.config[4][0].auto-start, as I can't get around the yaml
> list.
>
> 1)
> camel:
> route-template:
> config:
> "[4]":
> - template-id: "template-route"
> ...
> 2)
> camel:
> route-template:
> config:
> "[4]":
> template-id: "template-route"
> ...
>
> Pls. provide a possibility or an example to configure routes based on
> templates in YAML.
>
> Additional remark: I tried to set the route id in a route template definition
> converter, however, in DefaultModel.java, the id is overwritten after the
> converter is applied:
> RouteDefinition def = converter.apply(target, prop);
> if (routeId != null) {
> def.setId(routeId);
> }
> Is that intended?
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)