Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kamelets: create a camel-kamelet component #375

Closed
lburgazzoli opened this issue Jun 26, 2020 · 3 comments · Fixed by #456
Closed

kamelets: create a camel-kamelet component #375

lburgazzoli opened this issue Jun 26, 2020 · 3 comments · Fixed by #456
Assignees
Labels
Projects
Milestone

Comments

@lburgazzoli
Copy link
Contributor

As described in apache/camel-k#1567, a kamelet should be consumed like a regular component, like

from("timer:trigger")
    .to("kamelet:myKamelet?foo=bar")
    .log("${body}")

Mechanic

The createEndpoint of the kamelet component should looks like:

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)
}
@lburgazzoli
Copy link
Contributor Author

lburgazzoli commented Jul 19, 2020

lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Jul 19, 2020
@lburgazzoli
Copy link
Contributor Author

lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Jul 19, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Jul 19, 2020
davsclaus added a commit that referenced this issue Jul 30, 2020
@davsclaus
Copy link
Contributor

@lburgazzoli I took your work and created a branch on ASF so we all can push to it. Somehow I got a branch kamelets already exists so I named it -claus

https://github.com/apache/camel-k-runtime/tree/kamelets-claus

lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 10, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 10, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 10, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 10, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 10, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 12, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 13, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 18, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 19, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 19, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 19, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 26, 2020
@lburgazzoli lburgazzoli mentioned this issue Aug 27, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Aug 28, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 2, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 4, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 4, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 4, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 14, 2020
lburgazzoli pushed a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 14, 2020
lburgazzoli added a commit to lburgazzoli/apache-camel-k-runtime that referenced this issue Sep 14, 2020
@lburgazzoli lburgazzoli added this to the 1.5.0 milestone Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Kamelets
  
To do
Development

Successfully merging a pull request may close this issue.

2 participants