Thank you, I see the RoutesLoader loads the routes obtained by the ResourceLoader#resolveResource method, which can load for example a file.

I need to feed a "dynamically" generated InputStream to the loader. I'm guessing I might have to implement my own org.​apache.​camel.​spi.Resource to provide the stream/reader, but looking at the Resource api I'm failing to understand how do I signal the loader that it is a "yaml" character sequence and that the location might be fake. Should the getLocation() return something ending in ".yaml" and how free am I to invent what a getScheme() method returns?

/fedd

On 18.08.2023 14:15, Claus Ibsen wrote:
Hi

Yes you can use RoutesLoader to load routes from whatever resource, and
whatever DSL.

See PluginHelper to get hold of RoutesLoader.


On Fri, Aug 18, 2023 at 9:06 AM Fyodor Kravchenko <f...@vsetec.com> wrote:

Hello,

coudn't find it in the docs... what is the official/semi-official API to
load a route definition in a yaml format into the embedded Camel Context?

I tried to use camel-main to load them from files but I wanted to have
more flexibility as camel-main adds a seemingly unneeded extra layer and
to tweak it I anyway had to dive into the source to see how exactly it
loads/reloads the routes stored in the file resources. I see the piece
of code that loads the route in the RouteWatcherReloadStrategy and can
try to hack it out but I'd like to have it more official and also be
sure it survives the upgrade from my current 3.20.4 to, say, Camel 4.
Ideally it should work with a non-file streams as I generate the route
definitions from another snippet. I will provide the id and other
metadata if needed.

Thank you!


Reply via email to