camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf <>
Subject bean members with parallel processing
Date Thu, 20 Mar 2014 17:24:52 GMT

would the following route work correctly with multiple threads? In
beanRef("TestProcessor", "step2") the instance variable mapper is used, so I
suppose it is not thread safe, right? Should I set the mapper as a property
of the exchange?

            .beanRef("TestProcessor", "step1")
            .beanRef("TestProcessor", "step2")
            .beanRef("TestProcessor", "step3")

package testcamel;

import java.util.Map;
import org.apache.camel.Headers;

public class TestProcessor {

    private String generator;
    private JsonMapper mapper;

    public String step1(String filedata, @Headers Map headers) {
        //create mapper for each new message
        mapper = new JsonMapper();
        //do something here
        return "resultFromStep1";


    public String step2(String contentFromStep1) {
        //do something here with mapper
        return "resultFromStep2";

    public String step3(String contentFromStep2) {
        //do something here with mapper
        return "resultFromStep2";


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message