Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
@DynamicRouter AnnotationAs of Camel 2.5.0 we now support the use of @DynamicRouter on a bean method to easily create a Dynamic Router using a Java method. Simple Example using @Consume and @DynamicRouterpackage com.acme.foo; public class RouterBean { @Consume(uri = "activemq:foo") @DynamicRouter public String route(String body) { // compute where we should go next and return the uri of the endpoint. // return null to stop dynamic routing } } For example if the above bean is configured in Spring when using a <camelContext> element as follows <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd "> <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"/> <bean id="myDynamicRouter" class="com.acme.foo.RouterBean"/> </beans> then a route will be created consuming from the foo queue on the ActiveMQ component which when a message is received the message will routed dynamic using the Dynamic Router. |