camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <>
Subject route <-> XML <-> route
Date Mon, 25 May 2015 13:01:41 GMT

I'm wanting some guidance on how to generate a route definition using 
the API in a way that allows it to be converted to XML and then 
executed. I've got the basics sorted, but struggling on how to handle 
processors and beans.
For instance, if I generate a route like this:

// generate the route
RoutesDefinition routes1 = new RoutesDefinition()
RouteDefinition route = routes1.route()
route.log("Hello World!")
route.process(new SimpleProcessor())

// set route to context
CamelContext camelContext = new DefaultCamelContext()

Then the route works fine (e.g. my SimpleProcessor gets called as expected).
But if I generate the XML definition of the route it looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<routes xmlns="">
<from uri="timer://foo?fixedRate=true&amp;period=200"/>
<log message="Hello World!"/>

e.g. the processor definition has been lost.
I suspect I need to register the processor bean with the registry and 
use the processRef() method on the route, or something along those lines.
Does anyone have any examples of how to handle this?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message