Ritesh
Ritesh

Reputation: 1143

Apache Camel Java dsl tool

Is there any tool available that can convert java DSL to XML route or vice versa.

I want to convert the following XML route into Java DSL

<route id="test">
    <from uri="file://{{VAR_DATA_PATH}}/test/xml"/>
    <multicast>
        <choice>
            <when>
                <xpath>/bookinfo</xpath>
                <doTry>
                    <to uri="downloadBook"/>
                    <marshal ref="xstream-utf8"/>
                    <to uri="another URI"/>
                    <doCatch>
                        <exception>java.lang.Exception</exception>
                        <handled>
                            <constant>false</constant>
                        </handled>
                        <to uri="3rd URI"/>
                    </doCatch>
                </doTry>
            </when>
            <when>
                <xpath>somePath</xpath>
                <to uri="4th URI" />
                <to uri="5th URI"/>
            </when>
        </choice>
        <to uri="6th URI" />
    </multicast>
</route>

Upvotes: 0

Views: 364

Answers (1)

Ramin Arabbagheri
Ramin Arabbagheri

Reputation: 820

From Java DSL to XML, it's fairly easy. You can use Hawtio or karaf's "route-info" command. Even though the routes are in Java DSL, when you view them it would be XML.

I'm not aware of the other way around (from XML to Java) but it's not difficult at all to do it yourself.

Upvotes: 2

Related Questions