Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-17851

Unable to produce knative event to custom broker

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • camel-k-1.6.4-GA
    • camel-k-1.6-GA
    • Camel-K
    • None
    • False
    • False
    • % %
    • +
    • Automated

      I want to produce an event into a custom broker named mybroker with a following integration:

      // camel-k: language=java
      package com.test;
      
      import org.apache.camel.builder.RouteBuilder;
      
      public class MyRouteBuilder extends RouteBuilder {
          @Override
          public void configure() throws Exception {
              from("timer:x?repeatCount=1").setBody(constant("Hello")).to("knative:event/myevent?apiVersion=eventing.knative.dev/v1&kind=Broker&name=mybroker");
          }
      }
      

      This fails at runtime with:

      2021-11-22 10:01:35,225 ERROR [org.apa.cam.imp.eng.AbstractCamelContext] (main) Error starting CamelContext (camel-1) due to exception thrown: Failed to start route route1 because of null: org.apache.camel.FailedToStartRouteException: Failed to start route route1 because of null
      	at org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:123)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.doWarmUpRoutes(InternalRouteStartupManager.java:306)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.safelyStartRouteServices(InternalRouteStartupManager.java:189)
      	at org.apache.camel.impl.engine.InternalRouteStartupManager.doStartOrResumeRoutes(InternalRouteStartupManager.java:147)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:3167)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2847)
      	at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2798)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2494)
      	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:245)
      	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:139)
      	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$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
      	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
      	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:821)
      	at io.quarkus.runtime.Application.start(Application.java:101)
      	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
      	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
      	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
      	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:48)
      	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
      Caused by: org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: Unable to find a resource definition for event/sink/myevent
      	at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51)
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:67)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:130)
      	at org.apache.camel.impl.engine.DefaultChannel.doStart(DefaultChannel.java:126)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:116)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:130)
      	at org.apache.camel.processor.Pipeline.doStart(Pipeline.java:221)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
      	at org.apache.camel.support.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:89)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
      	at org.apache.camel.impl.engine.RouteService.startChildServices(RouteService.java:396)
      	at org.apache.camel.impl.engine.RouteService.doWarmUp(RouteService.java:193)
      	at org.apache.camel.impl.engine.RouteService.warmUp(RouteService.java:121)
      	... 29 more
      Caused by: java.lang.IllegalArgumentException: Unable to find a resource definition for event/sink/myevent
      	at org.apache.camel.component.knative.KnativeEndpoint.lambda$lookupServiceDefinition$2(KnativeEndpoint.java:161)
      	at java.base/java.util.Optional.orElseThrow(Optional.java:408)
      	at org.apache.camel.component.knative.KnativeEndpoint.lookupServiceDefinition(KnativeEndpoint.java:160)
      	at org.apache.camel.component.knative.KnativeEndpoint.createProducer(KnativeEndpoint.java:81)
      	at org.apache.camel.support.DefaultEndpoint.createAsyncProducer(DefaultEndpoint.java:197)
      	at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:245)
      	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:113)
      	at org.apache.camel.support.service.ServiceHelper.startService(ServiceHelper.java:130)
      	at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1638)
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:60)
      	... 45 more
      

      the related source is here: https://github.com/apache/camel-k-runtime/blob/release-1.9.x/components/camel-knative/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java#L152-L162

      according to the comment, when I substitute mybroker broker with default broker, it works ok

      Am I doing it correctly, or should I change something in the route definition to be able to use a different broker than default?

              pcongius Pasquale Congiusti
              avano@redhat.com Andrej Vano
              Andrej Vano Andrej Vano
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: