-
Notifications
You must be signed in to change notification settings - Fork 71
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
Bean reference and processors seem to be non-existent #736
Comments
Hello and thanks for the interest in camel-kamelets and Apache Camel in general. In pure Kamelet is really hard to add custom logic like bean, but you can always write your own kamelet without troubles. For example you could something like this: This is a way of calling a bean inside the Kamelet body, but I do think you're thinking about calling something like from kamelet-source and this is not possible currently and I think in the future too. The aim of Kamelets is abstracting the Apache Camel technical details by hiding them into logical unit, like a pre-baked endpoint, like a Kamelet is. You could always create a yaml route using the camel-kamelet components, like for example:
In yaml you'll have all the related definition from plain Camel In case you need to do something complex, my suggestion is using camel-kamelet component as the example above, mixed with the Yaml construct available. HTH a bit. |
Let me know if this answer your question. |
This is getting me closer than before, so yes, big help indeed. I am still a little fuzzy on how to pull all this together though. Would it be possible to see the definition for "org.apache.camel.kamelets.utils.transform.ExtractField". It's not quite clear how you would define that with yaml. Also, what steps would you need to take to make the bean available in your own flow? Please forgive me if this is documented somewhere. |
Ok picture is clearer now, I found it https://github.com/apache/camel-kamelets/blob/0.5.x/library/camel-kamelets-utils/src/main/java/org/apache/camel/kamelets/utils/transform/ExtractField.java. Part of my previous question remains, how would you make a custom bean like this available in the k8s environment. |
You need to pack it in a dependency, like jitpack or a maven one and reference it in your project. You're using camel-k right? |
Yes, new camel-k user here. I see and that's where https://camel.apache.org/camel-k/1.7.x/configuration/dependencies.html would come in. I assume there's not a more "direct" way to make that dependency available atm? |
In the past, for camel-k, you were able to pass multiple java/yaml/xml file, while running your integration with kamel run, this behavior has been updated at some point: apache/camel-k#1821 So, no, there is no more "direct" way. |
@oscerd thanks for all the information! I'll be closing this issue, but I do have one more question, if you don't mind. What does all this mean for bean reference support in Camel K. How would one handle strategy references on the enrich or aggregate EIPs for example? |
You can pack all of your strategies into a jar and place it on jitpack or on a private nexus or maven central and add them to your camel-k project as depedency. |
Ok, makes sense. Thank you for the help. |
Thanks a lot for your feedback and please, if you have questions or find something weird, just open an issues. Kamelet and camel-k are still under heavy development. |
It appears that references to beans and processor EIP are not a thing in kamelets. I think the reasons are pretty obvious given it's difficult to do custom logic in a static yaml template. I just want to make sure I am not missing something. Is there an idiomatic way to do custom processing in a kamelet. For example, multicast to multiple http endpoint and aggregating JSON from each respective response is a pattern I've used frequently. How could I replicate this in a kamelet?
The text was updated successfully, but these errors were encountered: