I don't know about Yaml, but this is how I load XML routes as String like
this:
loader = PluginHelper.getRoutesLoader(context);
loader.loadRoutes(setResource(route,"xml"));
private Resource setResource(String route, String type){
String uuid = UUID.randomUUID().toString();
if(type.equals("xml")){
return ResourceHelper.fromString("route_" + uuid + ".xml", route);
}else if(type.equals("yaml")){
return ResourceHelper.fromString("route_" + uuid + ".yaml", route);
}else{
log.warn("unknown route format");
}
}
Hope this helps.
Raymond
On Wed, Apr 9, 2025 at 1:30 AM Mitch Trachtenberg <[email protected]> wrote:
> Hi,
>
> I see there is a function YamlRoutesBuilderLoader, which returns a routes
> loader. It returns a RouteBuilder (?). I also see a build method, but
> that wants a yaml deserialization context (?).
>
> Is there any straightforward example of how to use the RouteBuilder
> returned by YamlRoutesBuilderLoader to load a route specified in a String
> or InputStream, in the 4.10.x series? I've tried about ten variants
> proposed by AIs that think they know more than they do, and it seems like
> there must be a method somewhere like loadYamlRouteFromStream.
>
> Thanks for any light that you can shed.
>
> Mitch
>