You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Aurélien Pupier (Jira)" <ji...@apache.org> on 2023/06/28 09:12:00 UTC
[jira] [Comment Edited] (CAMEL-19534) Support multiple Yaml document in same file for KameletBinding and Integration CRD
[ https://issues.apache.org/jira/browse/CAMEL-19534?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17738019#comment-17738019 ]
Aurélien Pupier edited comment on CAMEL-19534 at 6/28/23 9:11 AM:
------------------------------------------------------------------
For Integration, an alternative is to provide several flows:
{noformat}
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: route-3571
spec:
flows:
- from:
uri: timer:demo
steps:
- log:
message: demo
- from:
uri: timer:second
steps:
- log:
message: second
{noformat}
I have not found alternatives for Kamelet Binding
was (Author: apupier):
an alternative is to provide several flows:
{noformat}
apiVersion: camel.apache.org/v1
kind: Integration
metadata:
name: route-3571
spec:
flows:
- from:
uri: timer:demo
steps:
- log:
message: demo
- from:
uri: timer:second
steps:
- log:
message: second
{noformat}
> Support multiple Yaml document in same file for KameletBinding and Integration CRD
> ----------------------------------------------------------------------------------
>
> Key: CAMEL-19534
> URL: https://issues.apache.org/jira/browse/CAMEL-19534
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Affects Versions: 3.20.6
> Reporter: Aurélien Pupier
> Priority: Minor
>
> for instance with:
> {noformat}
> apiVersion: camel.apache.org/v1alpha1
> kind: KameletBinding
> metadata:
> name: route-2495
> spec:
> source:
> properties:
> message: demo
> ref:
> apiVersion: camel.apache.org/v1alpha1
> kind: Kamelet
> name: timer-source
> types: {}
> sink:
> properties: {}
> ref:
> apiVersion: camel.apache.org/v1alpha1
> kind: Kamelet
> name: log-sink
> types: {}
> ---
> apiVersion: camel.apache.org/v1alpha1
> kind: KameletBinding
> metadata:
> name: route-2683
> spec:
> source:
> properties:
> message: second route
> ref:
> apiVersion: camel.apache.org/v1alpha1
> kind: Kamelet
> name: timer-source
> types: {}
> sink:
> properties: {}
> ref:
> apiVersion: camel.apache.org/v1alpha1
> kind: Kamelet
> name: log-sink
> types: {}
> {noformat}
> when trying to run it with JBang, it gives this error:
> {noformat}
> 2023-06-28 10:24:35.040 INFO 788400 --- [ main] org.apache.camel.main.MainSupport : Apache Camel (JBang) 3.20.6 is starting
> 2023-06-28 10:24:35.530 INFO 788400 --- [ main] org.apache.camel.main.MainSupport : Using Java 17.0.3 with PID 788400. Started by apupier in /home/apupier/git/camel-kamelets/kamelets
> 2023-06-28 10:24:35.581 INFO 788400 --- [ main] mel.cli.connector.LocalCliConnector : Camel CLI enabled (local)
> org.apache.camel.RuntimeCamelException: Error pre-parsing resource: file:testKameletBinding.camel.yaml
> at org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader.preParseRoute(YamlRoutesBuilderLoader.java:863)
> at org.apache.camel.impl.engine.DefaultRoutesLoader.preParseRoute(DefaultRoutesLoader.java:148)
> at org.apache.camel.main.RoutesConfigurer.doConfigureModeline(RoutesConfigurer.java:324)
> at org.apache.camel.main.RoutesConfigurer.configureModeline(RoutesConfigurer.java:293)
> at org.apache.camel.main.BaseMainSupport.modelineRoutes(BaseMainSupport.java:629)
> at org.apache.camel.main.BaseMainSupport.autoconfigure(BaseMainSupport.java:485)
> at org.apache.camel.main.MainSupport.autoconfigure(MainSupport.java:74)
> at org.apache.camel.main.KameletMain.autoconfigure(KameletMain.java:489)
> at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:693)
> at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:404)
> at org.apache.camel.main.KameletMain.doInit(KameletMain.java:271)
> at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
> at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
> at org.apache.camel.dsl.jbang.core.commands.Run.runKameletMain(Run.java:784)
> at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:592)
> at org.apache.camel.dsl.jbang.core.commands.Run.doCall(Run.java:232)
> at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:73)
> at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:36)
> at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
> at picocli.CommandLine.access$1500(CommandLine.java:148)
> at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
> at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
> at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
> at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
> at picocli.CommandLine.execute(CommandLine.java:2170)
> at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:154)
> at main.CamelJBang.main(CamelJBang.java:36)
> Caused by: expected a single document in the stream
> in file:testKameletBinding.camel.yaml, line 1, column 1:
> apiVersion: camel.apache.org/v1a ...
> ^
> but found another document
> in file:testKameletBinding.camel.yaml, line 21, column 1:
> ---
> ^
> at org.snakeyaml.engine.v2.composer.Composer.getSingleNode(Composer.java:134)
> at org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader.preParseRoute(YamlRoutesBuilderLoader.java:860)
> ... 27 more
> {noformat}
> The advantage is that it allows to group some routes in the same file.
> I set camel-jbang component but I'm wondering if it is not something to implement only in model parsing and that it will be leveraged then in all runtime flavors
--
This message was sent by Atlassian Jira
(v8.20.10#820010)