apache camel - Set property on body using bean() -
i'm trying set property called "articleid" on exchange's body , thought explicit way use bean()
. however, can't work. when have following in route:
.bean(body(article.class), "setarticleid(${header.articleid})")
i error message:
caused by: org.apache.camel.component.bean.methodnotfoundexception: method name: setarticleid(${header.articleid}) not found on bean: bodyas[com.example.model.article] of type: org.apache.camel.builder.valuebuilder
my solution has been use processor()
, few lines of code in order set articleid property header value, me seems overkill.
i've been complaining on camel-users there isn't way this. here how tackle it:
.setheader("dummy").ognl("request.body.articleid = request.headers.articleid")
which requires adding camel-ognl dependency.
update
actually, there language endpoint can without setheader, have transform=false or else replaces body result:
.to("language:ognl:request.body.articleid = request.headers.articleid?transform-false")
Comments
Post a Comment