You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "aklemp (via GitHub)" <gi...@apache.org> on 2023/10/20 10:12:18 UTC

[I] nested Kamelets are not working [camel-k]

aklemp opened a new issue, #4837:
URL: https://github.com/apache/camel-k/issues/4837

   ### What happened?
   
   Combining Kamelets to bigger reusable Kamelets is not working. The pod complains about unknown endpoints. Even when the nested Kamelet is a standard one as in the example it cannot be found. Trying the `timer-source` directly in the integration is working.
   
   The [readme](https://github.com/apache/camel-kamelets/blob/main/README.md) suggests that it should be possible somehow to depend on something else except Camel components.
   
   ### Steps to reproduce
   
   1. create file nested.kamelet.yaml
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: Kamelet
   metadata:
     name: nested-source
     labels:
       camel.apache.org/kamelet.type: "source"
   spec:
     definition:
       title: "Nested"
       description: "Produces periodic events with a custom payload"
     dependencies:
       - github:apache/camel-kamelets
     template:
       from:
         uri: kamelet:timer-source
         parameters:
           period: 2000
           message: hello
         steps:
           - to: "kamelet:sink"
   ```
   2. deploy kamelet
   ```bash
   kubectl apply -f nested.kamelet.yaml
   ```
   3. create file integration-with-nested.yaml
   ```yaml
   apiVersion: camel.apache.org/v1
   kind: Integration
   metadata:
     name: integration-with-nested
   spec:
     flows:
     - route:
         from:
           uri: kamelet:nested-source
           steps:
           - log:
               message: ${body}
   ```
   4. deploy integration
   ```bash
   kubectl apply -f integration-with-nested.yaml
   ```
   5. check the logs of the pod
   ```bash
   kubectl logs -f integration-with-nested-...
   ```
   
   ### Relevant log output
   
   ```shell
   2023-10-20 09:55:25,247 INFO  [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 2.16.0
   2023-10-20 09:55:25,270 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) Bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
   2023-10-20 09:55:25,272 INFO  [org.apa.cam.mai.MainSupport] (main) Apache Camel (Main) 3.20.1 is starting
   2023-10-20 09:55:25,317 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='camel-k-embedded-flow', language='yaml', type='source', location='file:/etc/camel/sources/camel-k-embedded-flow.yaml', }
   2023-10-20 09:55:25,385 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='nested-source', language='yaml', type='source', location='file:/etc/camel/sources/nested-source.yaml', }
   2023-10-20 09:55:25,388 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='timer-source', language='yaml', type='source', location='file:/etc/camel/sources/timer-source.yaml', }
   2023-10-20 09:55:25,615 WARN  [org.apa.cam.imp.eng.AbstractCamelContext] (main) Lifecycle strategy org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler@96a75da vetoed initializing CamelContext (camel-1) due to: Failure creating route from template: nested-source
   2023-10-20 09:55:25,615 INFO  [org.apa.cam.imp.eng.AbstractCamelContext] (main) CamelContext (camel-1) vetoed to not initialize due to: Failure creating route from template: nested-source
   2023-10-20 09:55:25,616 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: org.apache.camel.RuntimeCamelException: org.apache.camel.VetoCamelContextStartException: Failure creating route from template: nested-source
           at org.apache.camel.RuntimeCamelException.wrapRuntimeException(RuntimeCamelException.java:66)
           at org.apache.camel.support.service.BaseService.doFail(BaseService.java:413)
           at org.apache.camel.impl.engine.AbstractCamelContext.doFail(AbstractCamelContext.java:3620)
           at org.apache.camel.support.service.BaseService.fail(BaseService.java:342)
           at org.apache.camel.impl.engine.AbstractCamelContext.failOnStartup(AbstractCamelContext.java:5313)
           at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2691)
           at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
           at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2698)
           at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
           at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94)
           at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
           at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:140)
           at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
           at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
           at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy_0(Unknown Source)
           at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy(Unknown Source)
           at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
           at io.quarkus.runtime.Application.start(Application.java:101)
           at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:108)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
           at io.quarkus.runner.GeneratedMain.main(Unknown Source)
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.base/java.lang.reflect.Method.invoke(Method.java:566)
           at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:61)
           at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
   Caused by: org.apache.camel.VetoCamelContextStartException: Failure creating route from template: nested-source
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.onContextInitialized(KameletComponent.java:433)
           at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:3017)
           at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:174)
           at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
           at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2679)
           ... 23 more
   Caused by: org.apache.camel.component.kamelet.KameletNotFoundException: Kamelet with id nested-source not found in locations: classpath:/kamelets
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:421)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.onContextInitialized(KameletComponent.java:430)
           ... 27 more
   Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route nested-source-1: Route(nested-source-1)[From[kamelet:timer-source?message=hel... because of Failed to resolve endpoint: kamelet://timer-source?message=hello&period=2000 due to: org.apache.camel.component.kamelet.KameletNotFoundException: Kamelet with id timer-source not found in locations: classpath:/kamelets
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:81)
           at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
           at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:937)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:416)
           ... 28 more
   Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: kamelet://timer-source?message=hello&period=2000 due to: org.apache.camel.component.kamelet.KameletNotFoundException: Kamelet with id timer-source not found in locations: classpath:/kamelets
           at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:1008)
           at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:890)
           at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
           at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:195)
           at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:95)
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
           ... 31 more
   Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.component.kamelet.KameletNotFoundException: Kamelet with id timer-source not found in locations: classpath:/kamelets
           at org.apache.camel.RuntimeCamelException.wrapRuntimeException(RuntimeCamelException.java:66)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.track(KameletComponent.java:450)
           at org.apache.camel.component.kamelet.KameletComponent$1.doInit(KameletComponent.java:160)
           at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
           at org.apache.camel.support.service.ServiceHelper.initService(ServiceHelper.java:84)
           at org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1602)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1543)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1538)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1533)
           at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:992)
           ... 36 more
   Caused by: org.apache.camel.component.kamelet.KameletNotFoundException: Kamelet with id timer-source not found in locations: classpath:/kamelets
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:421)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.track(KameletComponent.java:448)
           ... 44 more
   Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route timer-source-2: Route(timer-source-2)[From[timer:tick?period={{period}}&repe... because of No endpoint could be found for: timer://tick?period=2000, please check your classpath contains the needed Camel component jar.
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:81)
           at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
           at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:937)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:416)
           ... 45 more
   Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: timer://tick?period=2000, please check your classpath contains the needed Camel component jar.
           at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:1014)
           at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:890)
           at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
           at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:195)
           at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:95)
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
           ... 48 more
   
   2023-10-20 09:55:25,630 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): org.apache.camel.NoSuchEndpointException: No endpoint could be found for: timer://tick?period=2000, please check your classpath contains the needed Camel component jar.
           at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:1014)
           at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:890)
           at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
           at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:195)
           at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:95)
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
           at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
           at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:937)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:416)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.track(KameletComponent.java:448)
           at org.apache.camel.component.kamelet.KameletComponent$1.doInit(KameletComponent.java:160)
           at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
           at org.apache.camel.support.service.ServiceHelper.initService(ServiceHelper.java:84)
           at org.apache.camel.impl.engine.AbstractCamelContext.internalAddService(AbstractCamelContext.java:1602)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1543)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1538)
           at org.apache.camel.impl.engine.AbstractCamelContext.addService(AbstractCamelContext.java:1533)
           at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:992)
           at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:890)
           at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:62)
           at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:195)
           at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:95)
           at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:75)
           at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
           at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:937)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:416)
           at org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.onContextInitialized(KameletComponent.java:430)
           at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:3017)
           at org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:174)
           at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
           at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2679)
           at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
           at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2698)
           at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
           at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:94)
           at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
           at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:140)
           at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
           at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
           at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy_0(Unknown Source)
           at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot173480958.deploy(Unknown Source)
           at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
           at io.quarkus.runtime.Application.start(Application.java:101)
           at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:108)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
           at io.quarkus.runner.GeneratedMain.main(Unknown Source)
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.base/java.lang.reflect.Method.invoke(Method.java:566)
           at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:61)
           at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
   ```
   
   
   ### Camel K version
   
   v2.0.1


-- 
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: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] nested Kamelets are not working [camel-k]

Posted by "aklemp (via GitHub)" <gi...@apache.org>.
aklemp commented on issue #4837:
URL: https://github.com/apache/camel-k/issues/4837#issuecomment-1774778443

   Just for information, route templates can use Kamelets (so nesting of some sort is possible).
   ```java
   import org.apache.camel.builder.RouteBuilder;
   
   public class TemplateExample extends RouteBuilder {
       @Override
       public void configure() throws Exception {
           routeTemplate("myTemplate")
               .templateParameter("period", "3s")
               .templateParameter("message")
   	        .from("kamelet:timer-source?period={{period}}&message={{message}}")
                   .log("${body}");
   
           templatedRoute("myTemplate")
               .parameter("message", "Hello templated world!");
       }
   }
   ```
   ```bash
   kamel run TemplateExample.java
   ```
   However, I'm still struggling to deploy the template separate from the instantiating route (it doesn't find the template in its context).


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] nested Kamelets are not working [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #4837:
URL: https://github.com/apache/camel-k/issues/4837#issuecomment-1772535100

   Not a bug. It would be a feature to request on Camel framework project. See the ML thread: https://lists.apache.org/thread/22bzj6ghxhjdffgv06zz2pcg9htz99mo


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] nested Kamelets are not working [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on issue #4837:
URL: https://github.com/apache/camel-k/issues/4837#issuecomment-1772725125

   That's exactly the problem. The Kamelets are already Route Templates. So, the real requirement would be to nest a Route Template into another Route Template. I guess we enter in the experimentation domain. Feel free to raise a Jira Camel issue and, as usual, contributions are welcome.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] nested Kamelets are not working [camel-k]

Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez closed issue #4837: nested Kamelets are not working
URL: https://github.com/apache/camel-k/issues/4837


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] nested Kamelets are not working [camel-k]

Posted by "aklemp (via GitHub)" <gi...@apache.org>.
aklemp commented on issue #4837:
URL: https://github.com/apache/camel-k/issues/4837#issuecomment-1772629353

   Thank you for the very quick reply. Might there be another way to create reusable [route templates](https://camel.apache.org/manual/route-template.html) containing (custom) Kamelets with plain Camel K?


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org