'Is there something that converts a java dsl to xml dsl in camel?

I am thinking it would be useful to be useful to the routes in java and have them be convertable to xml automatically. Even if it is not fully convertible at least some measure of it can be done.

Does it already exist in some form ?



Solution 1:[1]

Yes try look at hawtio, which can output the routes in XML. And so can you as there is JMX API's or Java APIs when you run Camel, that can output the running routes in XML, regardless if you coded the routes in Java, Groovy, Scala, XML etc.

Solution 2:[2]

As Claus mentioned you can use hawtio for managing camel routes and you can see routes on their xml form, let me enrich his explanation with more pictures;

Here I wrote my routes on java dsl and can see their xml forms enter image description here

Or you can dump route as xml enter image description here

Solution 3:[3]

From AdviceWith source, there is

ExtendedCamelContext ecc = camelContext.adapt(ExtendedCamelContext.class);
...
ecc.getModelToXMLDumper().dumpModelAsXml(camelContext, definition);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Claus Ibsen
Solution 2 fakturk
Solution 3