camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xlogger <xloggers...@gmail.com>
Subject Load Endpoints from XML file
Date Thu, 29 Oct 2015 13:09:22 GMT
I have followed this link and was able to load route from XML file without
restarting CamelContext
http://camel.apache.org/loading-routes-from-xml-files.html

Here is the route XML that I have tested successfully
<routes xmlns="http://camel.apache.org/schema/spring">
  <route id="timer-route">
    <from uri="timer://foo?fixedRate=true&amp;period=3000"/>
    <log message="timer up!!"/>
  </route>
</routes>

I would like to modify my route by separating the Endpoint definition into
another XML. Here is the modified XML:

<routes xmlns="http://camel.apache.org/schema/spring">
  <endpoint id="test-timer" uri="timer://foo">
		<property key="fixedRate" value="true" />
		<property key="period" value="3000" />
	</endpoint>
  <route id="timer-route">
    <from uri="ref:test-timer" />
    <log message="timer up!!"/>
  </route>
</routes>

However, it failed with exception saying that the endpoint ref test-timer is
not found
Error message:
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.FailedToCreateRouteException: Failed to create route
timer-route: Route(timer-route)[[From[ref:test-timer]] -> [Log[timer up!!...
because of Failed to resolve endpoint: ref://test-timer due to: No bean
could be found in the registry for: test-timer of type:
org.apache.camel.Endpoint
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)


Would like to know if there is correct way to load Endpoint definition in
separate XML element, or even in separate XML file. Thus we don't need to
write a long URI and able to manage it clearly in key-value pair.





--
View this message in context: http://camel.465427.n5.nabble.com/Load-Endpoints-from-XML-file-tp5773190.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message