[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651820735 Here an example of a working code: ```yaml - from: uri: "timer:clock" parameters: period: "1000" steps: - set-body: constant: "foo" - process: ref: "toUpper" - to: log:info ``` ```java import org.apache.camel.Processor; import org.apache.camel.BindToRegistry; public class MyConfigurer { @BindToRegistry public Processor toUpper() { return e -> e.getMessage().setBody( e.getMessage().getBody(String.class).toUpperCase() ); } } ``` tested on OpenShift with the following command: kamel run --dev --name example routes.yaml MyConfigurer.java 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651813582 That error is probably about a wrong YAML indentation, as per the YAML guide, each step is represented by YAML map that has a single entry where the field name is the EIP name. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651575467 @doru1004 I'm honestly lost about what you are doing. So it seems you have both a `@BindToRegistry` and `--property camel.beans.myProcessor=#class:MyProcessor` and well, both are supposed to do the same thing. As already stated there is an issue in referencing a class by name if the class is provided as a CR (i.e. using `kamel run`) and this will be fixed in the next version but as camel-k is not a generic build system, adding arbitrary classes to the `kamel run` won't work and as I already said a number of time, use jitpack or publish your artefact to a maven repo. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651320592 I’d suggest to use jitpack or similar solution for that 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651139598 > > The current implementation only accept a reference to a Processor stored in the registry so to reference a class you should use the bean dsl, > > What's the YAML side code for using the reference? You need to bind a processor to the context with what @davsclaus described and the using the `ref` property of the `process` step, something like: ```yaml - from: uri: "direct:route" steps: - process: ref: "myProcessor" - to: "mock:route" ``` The processor need to be bound to the context, i.e. by using an additional class, like: ```java public class MyConfigurer { @BindToRegistry public myProcessor() { return e -> { ... }; } } ``` btw, we have also a gitter room and a mailing list for general discussions, whereas here is to report issues. [1] https://gitter.im/apache/camel-k [2] https://camel.apache.org/community/mailing-list 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-651136182 I've been recommending to use something like: ```yaml - from: uri: "direct:route" steps: - bean: bean-type: org.apache.camel.k.loader.yaml.support.MyUppercaseProcessor - to: "mock:route" ``` does that work for you ? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-650323419 The current implementation only accept a reference to a Processor stored in the registry so to reference a class you should use the bean dsl, however in the next release there should be support for that syntax too (the property it’s probably not be named class) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [camel-k] lburgazzoli commented on issue #1579: Running YAML code
lburgazzoli commented on issue #1579: URL: https://github.com/apache/camel-k/issues/1579#issuecomment-650318327 A fix for this will be available in the next release of the camel-k-runtime, however storing arbitrary code in a CR is not the recommended approach and best is to leverage jitpack or publish your artifact to a maven repo 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org