what should be the return value for transformMessage method in mule

廉价感情. 提交于 2020-01-06 14:35:16

问题


In my mule flow I am reading the message form WMQ using WMQ node and then calling a Java class using Java node for required processing of the message.

For the same I have to override the public Object transformMessage(MuleMessage message, String outputEncoding) method. This method is forcing me to return value but I don't require to send any object back.

Can someone please help me to understand what I need to return and why we have to return the value.

Cheers!


回答1:


First thing first, if you return something in your java code it won't automatically be sent back to WMQ like a response. The thing you return in the java node will be propagated to the next node in your flow, which in this case is nothing.

If you don't need to do anything after your java node in the flow I would suggest that you at least return the input payload. This will help you in the future if you would want to add anything after the java node.

The flow will automatically stop after it is finished with the java node.
But if you manipulate the incoming payload some how I would suggest that you return that payload instead for the same reason as above.

For returning the input payload:
return message.getPayload();



来源:https://stackoverflow.com/questions/26798383/what-should-be-the-return-value-for-transformmessage-method-in-mule

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!