You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "2tsheep (via GitHub)" <gi...@apache.org> on 2023/09/18 10:22:46 UTC

[GitHub] [camel-kamelets] 2tsheep opened a new issue, #1643: Using static methods to create beans in yaml dsl

2tsheep opened a new issue, #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643

   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: 
     - name: "influxdb"
       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!
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] oscerd commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1723188752

   I think this is not really easy to accomplish, not only in YAML DSL, but also through camel bean support. @davsclaus any idea?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] oscerd commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1723152653

   You can try to create a custom bean like in this example and pass to your route with #bean syntax: https://github.com/apache/camel-kamelets-examples/issues/21#issuecomment-1562486284
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] oscerd commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1723153393

   What runtime are you using?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] 2tsheep commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "2tsheep (via GitHub)" <gi...@apache.org>.
2tsheep commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1723187027

   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:
   `
   #camel-k: language=yaml dependency=camel-quarkus:influxdb
   - beans: 
     - name: "influxdb"
       type: "#ognl:@org.influxdb.InfluxDBFactory@connect"
       properties:
         url: "http://localhost:8086"
   
   - from:
       uri: "{{source}}"
       ...
       to: "influxdb:influxdb"
   `


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] 2tsheep commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "2tsheep (via GitHub)" <gi...@apache.org>.
2tsheep commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1733309955

   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:
   
   `- beans: 
     - name: "influxdbConnectionBean"
       type: org.influxdb.InfluxDBFactory#connect("url", "username","password")`


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] davsclaus commented on issue #1643: Using static methods to create beans in yaml dsl

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on issue #1643:
URL: https://github.com/apache/camel-kamelets/issues/1643#issuecomment-1730173241

   See details at
   https://camel.apache.org/components/4.0.x/others/main.html#_creating_custom_beans_with_factory_method


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel-kamelets] 2tsheep closed issue #1643: Using static methods to create beans in yaml dsl

Posted by "2tsheep (via GitHub)" <gi...@apache.org>.
2tsheep closed issue #1643: Using static methods to create beans in yaml dsl
URL: https://github.com/apache/camel-kamelets/issues/1643


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org