Friday, 15 July 2011

java - save original message use TO -



java - save original message use TO -

i new in camel world. wrote code, looks ugly:

from('component:params') .process(somevalidator()) .process{ def producertemplate = lookup('template', producertemplate.class) // create new exchange because need original in.body info in next routers def exchange = new defaultexchange(context) exchange.in.body = sometransformation(it.in.body) def result = producertemplate.send(somewhere, exchange) if (result.exception) throw result.exception } .process(someactionwithoriginalexchange(it.body.in))

i created add-on exchange class here. don't think idea. when seek rewrite utilize "transform" , "to" faced problem:

from('component:params') .process(somevalidator()) .process{// or maybe transform, guess doesn't matter here it.in.body = sometransformation(it.in.body) } .to(somewhere) .process(someactionwithoriginalexchange(??? how can original exchange????))

i don't understand how can save original message body?

you can phone call exchange.getunitofwork().getoriginalinmessage() within of bean or processor

java groovy apache-camel

No comments:

Post a Comment