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


   As described in https://github.com/apache/camel-k/issues/1567, a _kamelet_ 
should be consumed like a regular component, like
   
   ```java
   from("timer:trigger")
       .to("kamelet:myKamelet?foo=bar")
       .log("${body}")
   ```
   
   ### Mechanic
   The `createEndpoint` of the `kamelet` component should looks like:
   
   ```java
   Endpoint createEndpoint(String uri, String remaining, Map<String, Object> 
parameters) {
       var kameletName = StringHelper.before(reamining, "/");
       var kameletId = StringHelper.after(reamining, "/");
       if (kameletId == null) {
           kameletId = generateKameletId();
       }
   
       // load properties
       var options = new HashMap<String, Object>()
       options.putAll(getProperties("camel.kamelet." + kameletName))
       options.putAll(getProperties("camel.kamelet." + kameletName + "." + 
kameletId))
       options.putAll(parameters)
   
       // materialize a route builder by loading the kamelet as a standard 
source, so through
       // one of the available org.apache.camel.k.SourceLoader      
       var route = loadRoute(kameletName)
    
       // replace the input with a direct
       route.setInput("direct:" + kameletName + "-" + kameletId)
   
       // set route specific options
       // requires https://issues.apache.org/jira/browse/CAMEL-14963
       route.setPropertiers(options)
   
       // create an endpoint that connects the route create above
       return context.getEndpoint("direct:" + kameletName + "-" + kameletId)
   }
   ```
   
    


----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to