August 15, 2023

cDynamicRouter – Docs for ESB 6.x


Routes a message or messages to different endpoints on specified

cDynamicRouter Standard properties

These properties are used to configure cDynamicRouter running in the Standard Job framework.

The Standard
cDynamicRouter component belongs to the Routing family.

Basic settings

Bean class

Enter the name of the bean class to be used for the dynamic

Specify the method

Select this check box to specify the method to be
used which is defined in the bean class.

Ignore Invalid Endpoints

Select this check box to ignore unresolved
endpoint URIs. Clear the check box to throw an exception when
endpoint URIs are not valid.


Usage rule

cDynamicRouter is used as a
middle or end component in a Route.



Scenario: Routing files conditionally to different file paths

This scenario applies only to a Talend solution with ESB.

In this scenario, three file messages containing people information are routed to
different endpoints according to the city names they contain.

The following is an extract of the example XML files used in this use case:




A predefined Java bean, setDynaURI, is called in this use case to
return endpoint URIs according to the city name contained in each message, so that the
message containing the city name Washington will be routed to
endpoint Washington and so forth.

For more information about creating and using Java Beans, see
Talend Studio User

Dropping and linking the components


  1. From the Palette, expand the Connectivity folder, and drop one cFile and three cMessagingEndpoint components onto the design workspace.
  2. Expand the Routing folder, and drop a
    cDynamicRouter component onto the
    design workspace.
  3. Expand the Custom folder, and drop three cProcessor components onto the design
  4. Label the components for better identification of their respective
  5. Right-click the cFile component, select
    Row > Route from the contextual menu and click the cDynamicRouter component.
  6. Repeat this operation to connect the cMessagingEndpoint components to the cProcessor components.

Configuring the components and connections

  1. Double-click the input cFile component to
    display its Basic settings view in the
    Component tab and set its properties.

    In this use case, simply specify the input file path and leave the other
    parameters as they are.

  2. Double-click the cDynamicRouter component
    to display its Basic settings view in the
    Component tab.
  3. In the Bean class field, type in the name
    of the predefined Java bean. Leave the Specify the
    check box unselected as there is only one method in
    the Java bean and leave the Ignore Invalid
    check box unselected if you want the component to
    throw an exception when endpoint URIs are not valid.


  4. Double-click the first cMessagingEndpoint
    component, which is labelled Washington,
    to display its Basic settings view in the
    Component tab, and type in the URI in
    the URI field for the destination of your

    Here, we want to use this component to retrieve the message routed to the
    URI direct:Washington, as shown below.

  5. Repeat this step to set the endpoint URIs for the other two cMessagingEndpoint components:
    direct:London and
    direct:Beijing respectively.
  6. Double-click the first cProcessor component, which is labelled Monitor_Washington, to display its Basic
    view in the Component


  7. In the Code box, customize the code to
    display the file name of the message routed to the endpoint Washington on the console.

  8. Repeat these steps to configure the other two cProcessor components to display the file names of the
    messages routed to the endpoints London and
    Beijing respectively.
  9. Press Ctrl+S to save your Route.

Viewing code and executing the Route

  1. Click the Code tab at the bottom of the
    design workspace to have a look at the generated code.


    As shown in the code, the incoming message from the endpoint
    Message_source is routed by .dynamicRouter to
    endpoints the URIs of which are dynamically set according to
  2. Click the Run view to display it and
    click the Run button to launch the
    execution of your Route.

    You can also press F6 to execute it.
    RESULT: The source messages are routed to different endpoints based on the
    city names contained in the messages.

Document get from Talend
Thank you for watching.
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x