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: support for kamelet local beans #2271

Closed
lburgazzoli opened this issue May 5, 2021 · 4 comments
Closed

kamelets: support for kamelet local beans #2271

lburgazzoli opened this issue May 5, 2021 · 4 comments
Assignees
Milestone

Comments

@lburgazzoli
Copy link
Contributor

lburgazzoli commented May 5, 2021

Route Template local beans is approaching and we need to define how we can leverage such functionality in camel-k and in the kamelets definition.

The current layout for kamelets is:

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: telegram-text-source e"
spec:
  ...
  flow: 
    from:
      uri: direct:start
      steps:
         ...

I'd propose to replaces flow with template so it would looks like:

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: telegram-text-source e"
spec:
  ...
  template: 
    beans:
      - name: myBean
        type: com.acme.MyBean
        properties:
         foo: "bar"
    from:
      uri: direct:start
      steps:
        - process: "myBean"

NOTE:

  • we should keep flow for backward compatibility but to create template local beans one has to use template keyword.
  • the new template keyword can be provided by the Camel YAML DSL so we can reduce the custom code we have to maintain for camel-k.

The code generated by the camel-k operator should then be:

- template: 
    beans:
      - name: myBean
        type: com.acme.MyBean
        properties:
         foo: "bar"
    from:
      uri: direct:start
      steps:
        - process: "myBean"
@lburgazzoli
Copy link
Contributor Author

lburgazzoli commented May 5, 2021

/cc @nicolaferraro
/cc @davsclaus
/cc @heiko-braun

@lburgazzoli
Copy link
Contributor Author

@davsclaus
Copy link
Contributor

Yeah then the beans part of the template can then use the new local bean bind in camel-core (Camel 3.10 - CAMEL-16584). Then that bean myBean is local and only available while the template is creating routes. And each route will have its own instance that bean created.

The route template DSL in camel-core-model, does not however have beans, but its a novel idea, we could consider adding that, which allow this to be done in a more general and vanilla fashion with camel-core for all runtimes (not a special syntax in camel-k).

@lburgazzoli
Copy link
Contributor Author

The route template DSL in camel-core-model, does not however have beans, but its a novel idea, we could consider adding that, which allow this to be done in a more general and vanilla fashion with camel-core for all runtimes (not a special syntax in camel-k).

yep absolutely true, the goal is to have it also in the XML DSL at some point.

@nicolaferraro nicolaferraro self-assigned this Jun 7, 2021
@nicolaferraro nicolaferraro added this to the 1.5.0 milestone Jun 7, 2021
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jun 8, 2021
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jun 9, 2021
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Jun 9, 2021
orpiske pushed a commit to orpiske/camel-k that referenced this issue Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants