I think i was wrong, the info on this page:
http://camel.apache.org/loading-routes-from-xml-files.html
is the right answer, however, i think i'm missing something. Currently, i
have a camel route that looks like this:
public void configure() throws Exception {
FileInputStream fis = new FileInputStream("myroute.xml");
RoutesDefinition routes =
getContext().loadRoutesDefinition(fis);
}
And my myroute.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring">
<bean id="myPojo" class="com.mycompany.MyPojo"/>
<route>
<from uri="quartz://fetchUrl?cron=0+0/1+*+*+*+?"/>
<setProperty propertyName="contract">
<simple>contract</simple>
</setProperty>
<setProperty propertyName="dataFeedSource">
<simple>dataFeedSource</simple>
</setProperty>
<setProperty propertyName="dataFeedType">
<simple>dataFeedType</simple>
</setProperty>
<setProperty propertyName="url">
<simple>url</simple>
</setProperty>
<bean ref="myPojo" method="getHtmlCode"/>
<bean ref="myPojo" method="getUrls"/>
<split>
<tokenize token="\n"/>
<to uri="seda:theUrls"/>
</split>
</route>
<route>
<from uri="seda:theUrls?concurrentConsumers=8"/>
<bean ref="myPojo" method="setUrl"/>
<to uri="http://dummyhost" />
<bean ref="myPojo" method="processContent"/>
</route>
</routes>
As you can see, i'm declaring a bean using this:
<bean id="myPojo" class="com.mycompany.MyPojo"/>
However, at the moment of running this code, i'm getting this exception:
Failed to create route route1 at: >>> Bean[ref:myPojo method: getHtmlCode]
because of No bean could be found in the registry for: myPojo
Caused by: org.apache.camel.NoSuchBeanException: No bean could be found in
the registry for: myPojo
at
org.apache.camel.component.bean.RegistryBean.getBean(RegistryBean.java:68)
at
org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:155)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:433)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:181)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:815)
Am i missing another step on the process??
--
View this message in context:
http://camel.465427.n5.nabble.com/Injecting-data-to-routes-loaded-from-xml-file-tp4639765p4643056.html
Sent from the Camel - Users mailing list archive at Nabble.com.