You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Groovy Renderer User Guide

This page presents how to editing the route definition in Groovy language through the Web Console which supports updating the routes in XML and Groovy now.

After opening your route in your browser, the URL may be http://localhost:8080/routes/route1, you can choose the edit link with Groovy language to update it. The GroovyRenderer will turn the route into Groovy route definition. For example, after chooseing to edit a route defined by the following XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="route1" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="http://camel.apache.org/schema/spring">
    <description>This is an example route which you can start, stop and modify</description>
    <from uri="seda:foo"/>
    <to uri="mock:results" id="to1"/>
</route>

The GroovyRenderer will translate it into a route definition as follows:

import org.apache.camel.language.groovy.GroovyRouteBuilder;
class GroovyRoute extends GroovyRouteBuilder {
    void configure() {
        from("seda:foo").to("mock:results")
    }
}
  • No labels