-
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
Using static methods to create beans in yaml dsl #1643
Comments
You can try to create a custom bean like in this example and pass to your route with #bean syntax: apache/camel-kamelets-examples#21 (comment) |
What runtime are you using? |
I am using camel-k 1.12.1 and Im running the integrations on a local kubernetes cluster using Docker Desktop 4.22.1 with knative. I am not sure if I completely understand what the linked example does. It registers a custom class to the bean registry which then allows us to address the defined methods in the class, is that right? Would this also create a connection bean which I need to send data to an influxdb using the influxdb endpoint? If it is possible I would like to avoid creating custom beans in java and solely rely on yaml dsl. I'll add this here for maybe a little more clarification:
|
I think this is not really easy to accomplish, not only in YAML DSL, but also through camel bean support. @davsclaus any idea? |
I apologise for the late reply and thank you very much for the help. A colleague of mine managed to find a way to solve this solely through YAML DSL. It is possible to address a static method by using the following syntax:
|
Hello everyone,
I hope that this is the right place for this question.
I want to create a connection bean to an influxdb in yaml dsl. However, I was not able to find anything in the documentation or in the examples which specifies how a static or even a specific method can be addressed. Here is an example Code Snippet:
`- beans:
type: "org.influxdb.InfluxDBFactory"
properties:
url: "http://localhost:8086"`
This does not work since this class does not have a constructor which returns an instance of InfluxdDB and I cannot figure out how to specify that I want to address the "connect" method provided in that class. I know that this class references uses the constructors of org.influxdb.impl.InfluxDBImpl to create the desired instances but I don't know either how I could create and pass an Object of type OkHttpClient to that constructor,
Is there a way to address static methods when creating beans ?
What would be the recommended way to achieve the desired behaviour?
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: