nicolaferraro opened a new issue #631:
URL: https://github.com/apache/camel-k-runtime/issues/631


   Opening it here to discuss it better, but maybe now it's also a core Camel 
concern.
   
   I need to define a Kamelet with an optional parameter, so;
   
   ```yaml
   # ...
   spec:
     definition:
       properties:
         clientId: # this is optional, no default value
           type: string
     flow:
       from:
         uri: paho:the-topic
         parameters:
           clientId: "{{clientId}}"
           brokerUrl: "the-url"
   ```
   
   This is how I'd define such Kamelet.
   
   If I don't set any value for `clientId`, the operator does not pass any 
value in application properties for `camel.kamelet.mqtt-source.clientId`.
   
   But, even if the clientId is not marked as required, the route template 
engine fails with:
   
   ```
   2021-02-16 09:02:59,624 ERROR [io.qua.run.Application] (main) Failed to 
start application (with profile prod): java.lang.IllegalArgumentException: 
Route template mqtt-source the following mandatory parameters must be provided: 
clientId
           at 
org.apache.camel.quarkus.core.BaseModel.addRouteFromTemplate(BaseModel.java:225)
           at 
org.apache.camel.quarkus.core.FastCamelContext.addRouteFromTemplate(FastCamelContext.java:199)
           at 
org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.createRouteForEndpoint(KameletComponent.java:370)
           at 
org.apache.camel.component.kamelet.KameletComponent$LifecycleHandler.onContextInitialized(KameletComponent.java:339)
           at 
org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2646)
           at 
org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:505)
           at 
org.apache.camel.support.service.BaseService.init(BaseService.java:83)
           at 
org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2414)
           at 
org.apache.camel.support.service.BaseService.start(BaseService.java:111)
           at 
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2431)
           at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:75)
           at 
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
           at 
org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:120)
           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:534)
           at io.quarkus.runtime.Application.start(Application.java:90)
           at 
io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:62)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
           at io.quarkus.runtime.Quarkus.run(Quarkus.java:104)
           at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
   ```
   
   A related problem is to ensure that once the issue is fixed, the `clientId` 
in the `paho` endpoint is not passed at all (i.e. not passed as "" empty 
string).
   
   cc: @lburgazzoli 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to