You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ravi21588 <ra...@gmail.com> on 2016/05/13 12:09:44 UTC

Query in using Dynamic router EIP

Hi All,

I have a query related to dynamic router EIP.

The diagram in camel site shows the EIP has a Dynamic rule base store  and a
control channel .

I just saw the implemented example in Documentation

<bean id="mySlip" class="org.apache.camel.processor.DynamicRouterTest"/>
 
<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
        <from uri="direct:start"/>
        <dynamicRouter>
            
            <method ref="mySlip" method="slip"/>
        </dynamicRouter>
    </route>
 
    <route>
        <from uri="direct:foo"/>
        <transform><constant>Bye World</constant></transform>
    </route>
 
</camelContext>


and the java bean mySlip handles the logic which 

/**
 * Use this method to compute dynamic where we should route next.
 *
 * @param body the message body
 * @return endpoints to go, or <tt>null</tt> to indicate the end
 */
public String slip(String body) {
    bodies.add(body);
    invoked++;
 
    if (invoked == 1) {
        return "mock:a";
    } else if (invoked == 2) {
        return "mock:b,mock:c";
    } else if (invoked == 3) {
        return "direct:foo";
    } else if (invoked == 4) {
        return "mock:result";
    }
 
    // no more so return null
    return null;
}


can you please tell what is acting as a control channel and Dynamic rule
base store.

Does Dynamic rule base store means persistent data store?


Also in the EIP Book says as below.

During system start-up, each potential recipient sends a special message to
the Dynamic Router on this control channel, announcing its presence and
listing the conditions under which it can handle a message. The Dynamic
Router stores the 'preferences' for each participant in a rule base. When a
message arrives, the Dynamic Router evaluates all rules and routes the
message to the recipient whose rules are fulfilled. This allows for
efficient, predictive routing without the maintenance dependency of the
Dynamic Router on each potential recipient.

Can you please tell how does it happens?




--
View this message in context: http://camel.465427.n5.nabble.com/Query-in-using-Dynamic-router-EIP-tp5782554.html
Sent from the Camel - Users mailing list archive at Nabble.com.