ESB MULE将参数传递给java方法 [英] ESB MULE passing the parameters to the java method
本文介绍了ESB MULE将参数传递给java方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用MULE版本3.3.0 CE,我想从入站头中获取一些值,然后将其传递给java方法,在java方法中对传递的值进行一些更改,最后再次将其从java方法传递给出站???
I use MULE version 3.3.0 CE, I want to get some value from header in inbound and then pass it to a java method, in java method making some changes on passed value, finally again I pass it from java method to the outbound????
推荐答案
您可以仅使用MEL来代替Java Bean与Mule API的绑定(使用Callable
),例如:
Instead of tying your Java beans to the Mule API (with Callable
), you can do this using MEL only, for example with:
<invoke object-ref="yourBean"
method="yourMethod"
methodArguments="#[message.inboundProperties['inboundPropertyName']]" />
<set-property propertyName="outboundPropertyName"
value="#[payload]" />
这有一个警告,消息有效负载受invoke
元素影响.如果这是一个问题,那么您可以选择:
This has the caveat that the message payload is affected by the invoke
element. If this is a problem then you can go with:
<expression-component>
propVal = app.registry.yourBean.yourMethod(message.inboundProperties['inboundPropertyName']);
message.outboundProperties['outboundPropertyName'] = propVal;
</expression-component>
这篇关于ESB MULE将参数传递给java方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文