m子中transformMessage方法的返回值应该是多少 [英] what should be the return value for transformMessage method in mule

查看:115
本文介绍了m子中transformMessage方法的返回值应该是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ule子流程中,我正在使用WMQ节点读取WMQ消息形式,然后使用Java节点调用Java类来进行消息的必需处理.

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.

同样,我必须重写公共对象transformMessage(MuleMessage消息,字符串outputEncoding)方法.这种方法迫使我返回值,但是我不需要将任何对象发回.

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.

干杯!

推荐答案

首先,如果您在Java代码中返回了某些内容,它将不会像响应一样自动发送回WMQ.您在java节点中返回的内容将传播到流中的下一个节点,在这种情况下,它什么也没有.

如果您不需要在流中的java节点之后执行任何操作,则建议您至少返回输入有效负载.如果您想在java节点之后添加任何内容,这将对将来有帮助.

该流将在完成Java节点后自动停止.
但是,如果您操纵传入的有效负载,则出于与上述相同的原因,我建议您建议您返回该有效负载.

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.

用于返回输入有效载荷:
return message.getPayload();

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

这篇关于m子中transformMessage方法的返回值应该是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆