Trying to add Spring bean to Camel body property. Something like:
MVEL: exchange.in.body.limit = uiLimit
<transform>
<mvel>
exchange.in.body.limit = uiLimit;
exchange.in.body;
</mvel>
</transform>
Spel: request.body.limit = uiLimit
Or even putting in header first:
<setHeader headerName="limit">
<simple>ref:uiLimit</simple>
</setHeader>
Where uiLimit is:
<bean id="uiLimit" class="java.math.BigInteger">
<constructor-arg value="${UI_LIMIT} />
</bean>
And still getting null in header and property.
Any ideas why bean lookup in Registry doesn't work for OSGI? (all beans/routes inside single bundle)
PS: this works fine in Route:
<bean ref="uiLimit" method="toString"/>
The transform
is only for transforming the message body. Not to mutate headers.
If you want to change a header, use setHeader
The reason of such behaviour is that Exchange created in another bundle and came via exposed service:
<osgi:service ref="someHandler" interface="org.apache.camel.Component"/>
Exchange contains Registry/Context from another bundle where this bean is not declared. All expression languages are working with Registry/Context attached to Exchange and not with Registry of current budle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.