Hi You likely have a bug in your custom code. Sounds like you need to create a new fromList instance for each exchange so they do not refer and use a shared list.
On Fri, Mar 21, 2014 at 5:50 PM, manishk <[email protected]> wrote: > Hello, I am new to camel and have just started working on a integration > project. > 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 > @Override > public void process(Exchange exchange) throws Exception { > MyMessage myMessage = exchange.getIn().getBody(MyMessage.class); > {//iterate over the collection > > //do some processing > myMessage.setTarget(fromList); > Exchange newExchange = new DefaultExchange(exchange.getContext()); > newExchange.getIn().setBody(myMessage, MyMessage.class); > newExchange.getIn().setHeader("target", fromList); > exchange.getContext().createProducerTemplate() > .send("seda:processResults", newExchange); > } > } > > PS: the header i set does not have the same issue. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/spawning-exchanges-from-the-processor-tp5749208.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io
