Hi guys,

  from the dynamic-router webpage, there is an example:


/**
 * 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;
}


But if there are multiple messages, that 'invoked' variable won't be thread
safe. How can we solve this?



Thanks



-- 
View this message in context: 
http://camel.465427.n5.nabble.com/dynamicRouter-Thread-safe-issue-tp3305007p3305007.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to