This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • DynamicRouter Annotation
Skip to end of metadata
Go to start of metadata

@DynamicRouter Annotation

As 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 @DynamicRouter


public class RouterBean {

    @Consume(uri = "activemq:foo")
    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=""

  <camelContext xmlns=""/>

  <bean id="myDynamicRouter" class=""/>


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.

  • No labels