You can try look at local beans with "script" where you can embed the java code https://camel.apache.org/manual/route-template.html#_binding_beans_to_route_templates_using_bean_types
However that is used for kamelets, but could potentially also work in yaml-dsl, where you can declare beans as well On Thu, Feb 16, 2023 at 7:27 AM Mikael Koskinen <mijap...@gmail.com> wrote: > Hey, > > Few minutes later... > > camel run aggregator.yaml Aggregator.java > > Seems to work. I kind of thought that the files given to the run > command are just integration files but this is good. > > Now, if there's a possibility to include the Aggregator.java inside > the aggregator.yaml somehow, that would be great :) > > Best regards, > Mikael > > to 16. helmik. 2023 klo 8.21 Mikael Koskinen (mijap...@gmail.com) > kirjoitti: > > > > Hi, > > > > I'm trying but failing to use Java processors/Java classes when > > writing integrations with YAML and running them with Camel JBang. > > > > I started by cloning this example: > > > https://github.com/apache/camel-karavan/tree/main/karavan-demo/aggregator > > > > But running with using simple: > > > > camel run aggregator.yaml > > > > Gives an error: > > Failed to create route route1 at: >>> PollEnrich[simple{file:file_src?noo > > p=true}] <<< in route: > > Route(route1)[From[timer:test?delay=1000&period=3000] -> [Se... > > because of Cannot find Aggregatio > > nStrategy in Registry with name: #aggregator > > > > So I checked the documentation and I found this mention: > > > > > https://camel.apache.org/manual/camel-jbang.html#_using_java_beans_and_processors > > --- > > There is basic support for including regular Java source files > > together with Camel routes, and let Camel JBang runtime compile the > > Java source. This means you can include smaller utility classes, > > POJOs, Camel Processors and whatnot that the application needs. > > --- > > > > I think I could package the java-file into a jar and then use that as > > a dependency but I would like to use java-files if possible. And if > > possible, embedding them inside the YAML sounds interesting. > > > > I think I'm missing something simple as it is still early morning but > > if anyone has any tips to offer, I'm happy for the assistance. > > > > Kind regards, > > Mikael > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2