【问题标题】:Multiple Enrichers fail in Mule FlowMule Flow 中的多个浓缩器失败
【发布时间】:2016-02-25 01:23:01
【问题描述】:

问题是我有两个根据负载类型交替调用的 Enricher。 Foo 类调用一个 SAP 函数模块,而 Bar 类调用一个不同的函数模块。 Choice 路由器会检查有效负载类型并相应地正确地进行路由。

当子流返回到浓缩器时,浓缩器开始工作——在这种可重复的场景中除外。

从浏览器中,如果我使用 Foo 类的 URL 访问 HTTP 端点,它可以完美运行。如果我“停止”mule 服务器(localhost),然后重新启动它,我可以使用适用于类 Bar 的 URL 调用 HTTP 端点。而且,它工作得很好。

但是,我不能做的是让骡子应用程序运行,并交替来自浏览器的调用。当您选择导致不同路由的第二个 url 时,会从子流中执行错误的扩充器。

总结一下:

  1. 一遍又一遍地调用Foo url就好了,然后调用Bar url--it 失败。
  2. 停止/重启服务器
  3. 一遍遍调用Bar url就好了,然后调用Foo url--it 失败。

下面是我们得到的 NullPointerException。 stacktrace 是场景 1 的一个示例。我已经调用了 Foo url 一次或多次,然后调用了 Bar url。有效负载类型是 Bar,但 mule 试图调用的 Enricher 来自 Foo 丰富器,它为 null。

    ERROR 2015-07-18 07:33:35,296 [[vistaar].connector.http.mule.default.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy: 
********************************************************************************
Message               : Execution of the expression "payload.bapiFunction=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: Bar
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. null (java.lang.NullPointerException)
  org.mule.mvel2.DataConversion:129 (null)
2. error calling method: com.company.foo.**Foo.**setBapiFunction (java.lang.RuntimeException)
  org.mule.mvel2.optimizers.impl.refl.nodes.SetterAccessor:46 (null)
3. Execution of the expression "payload.bapiFunction=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException)
  org.mule.el.mvel.MVELExpressionLanguage:202 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/expression/ExpressionRuntimeException.html)
4. Execution of the expression "payload.bapiFunction=__object_for_enrichment" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: **Bar** (org.mule.api.MessagingException)
  org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.NullPointerException
    at org.mule.mvel2.DataConversion.convert(DataConversion.java:129)
    at org.mule.mvel2.optimizers.impl.refl.nodes.SetterAccessor.setValue(SetterAccessor.java:25)
    at org.mule.mvel2.optimizers.impl.refl.nodes.SetterAccessor.setValue(SetterAccessor.java:41)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

这是我的流程...

<foreach doc:name="For Each" collection="payload.getObjectList()" counterVariableName="count">

<expression-component doc:name="Build Bapi Pojo"><![CDATA[payload.buildBapiFunction();]]></expression-component>

    <choice doc:name="Choice">
        <when expression="payload is com.mycompany.project.Foo">
            <enricher source="#[payload]" target="#[payload.bapiFunction]" doc:name="Enrich w/Sales Deal RFC results">
                <flow-ref name="sales-deal-rfc-flow" doc:name="RFC" />
            </enricher>
        </when>
        <when expression="payload is com.mycompany.project.Bar">
            <enricher source="#[payload]" target="#[payload.bapiFunction]" doc:name="Enrich w/Price Struct RFC results">
                <flow-ref name="price-struct-rfc-flow" doc:name="RFC" />
            </enricher>
        </when>
        <otherwise>
            <logger message="#['Should never be here.']" level="INFO" doc:name="Impossible" />
        </otherwise>
    </choice>

</foreach>

<sub-flow name="sales-deal-rfc-flow" doc:name="sales-deal-rfc-flow">

    <data-mapper:transform config-ref="Pojo_To_Xml" doc:name="Pojo To Xml" />

    <sap:outbound-endpoint exchange-pattern="request-response" connector-ref="SAP" type="function" functionName="ZFM_OPROI1110_SDCR"
        xmlVersion="2" outputXml="true" evaluateFunctionResponse="true" responseTimeout="10000" doc:name="SAP" />

    <data-mapper:transform config-ref="Xml_To_Pojo" doc:name="Xml To Pojo" />

</sub-flow>


<sub-flow name="price-struct-rfc-flow" doc:name="price-struct-rfc-flow">

    <data-mapper:transform config-ref="Pojo_To_Xml_1" doc:name="Pojo To Xml" />

    <sap:outbound-endpoint connector-ref="SAP" type="function" functionName="ZFM_OPROI1105_PS" xmlVersion="2" outputXml="true"
        evaluateFunctionResponse="true" responseTimeout="10000" doc:name="SAP" exchange-pattern="request-response" />

    <data-mapper:transform config-ref="Xml_To_Pojo_1" doc:name="Xml To Pojo" />

</sub-flow>

【问题讨论】:

    标签: mule mule-studio


    【解决方案1】:

    您是否在执行选择路由器之前对其进行了调试以验证有效负载类?当通过 Bar URL(重新场景 1)调用时,它确实是 Bar 类吗?如果是,可能is 没有按预期工作。你试过用instanceof 代替吗?

    【讨论】:

    • 有效载荷绝对是正确的有效载荷(类)。我还尝试将消息丰富器包围在处理器链中——结果相同。我尝试让丰富器更新一个变量,然后添加一个 separa.3te 步骤来更新我的原始有效负载类。
    • 我还尝试为每个 Message Enricher 更新不同的变量......都是一样的。我刚试过instanceof vs is。路由正常进行。我已经验证了几种方法(调试器、记录器转储#[payload.class] 等..
    • 这是一种奇怪的行为。如果您仍然遇到此问题,请尝试删除 mule 表达式标签是否可以解决此问题。例如,&lt;enricher source="payload" target="payload.bapiFunction" doc:name="Enrich w/Sales Deal RFC results"&gt;
    • 我们已将此问题提交给 Mulesoft 支持。他们已经承认了这个缺陷,并且正在研究如何修复。当我收到他们关于决议的消息时,我也会在这里发布。
    • 谢谢。如果您有 JIRA 链接,那就太好了。知道那里出了什么问题很有趣。奇怪的问题。
    【解决方案2】:

    这被证明是一个骡虫。他们给我们发了一个补丁。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多