You can use the bean method return the message body just like this public class Bar { @Handler public Foo doSomething(@Header("age")Integer age, @Body Foo foo) { foo.setAge(age); return foo; }
from("activemq:someQueue"). bean(Bar.class); You can find more information about Bean Binding here[1] [1]https://camel.apache.org/bean-binding.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On January 21, 2015 at 4:27:37 AM, gilboy (josephoto...@gmail.com) wrote: > Hi > > In my route, I have a header property on the exchange called age. In the > body of the exchange I have a person object. I want to set the age property > on the person object. > > If I do something like the following in my route and have the setAge > property on the Person bean use the header annotation(e.g. > setAge(@Header("age")Integer age)) the property will get correctly set. > However, the setter message is void, hence the body on the exchange gets > wiped. I can have the setter method return "*this*" but it feels wrong > > > ${body.setAge} > > > Any other solution? > Thanks > Joe > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Issue-setting-property-on-the-object-which-in-the-exchange-body-tp5761960.html > > Sent from the Camel - Users mailing list archive at Nabble.com. >