camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishk <>
Subject spawning exchanges from the processor
Date Fri, 21 Mar 2014 16:50:04 GMT
Hello, I am new to camel and have just started working on a integration
The scenario i have is as follows,
i receive a message on an endpoint, pass it to a Processor. The processor
iterates over a List(contains a collection of a specific attribute to be set
in the message) and sets an attribute of the message each time and sends the
exchange to another endpoint.
I see that the exchanges are getting spawned from the Processor but the
problem is that all the messages received contain the same value of the
attribute set from the List. Example, if List has values
("targetA","targetB") and i iterate over this and set the message and the
send it to my endpoint,
I receive two messages but both have the same target set i.e "targetA".

Below is the code snippet of the processor
    public void process(Exchange exchange) throws Exception {
        MyMessage myMessage = exchange.getIn().getBody(MyMessage.class);
        {//iterate over the collection
       //do some processing
        Exchange newExchange = new DefaultExchange(exchange.getContext());
        newExchange.getIn().setBody(myMessage, MyMessage.class);
        newExchange.getIn().setHeader("target", fromList);  
                            .send("seda:processResults", newExchange); 

PS: the header i set does not have the same issue.

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

View raw message