Mule “如何重复使用”;选择例外策略“;骡子

Mule “如何重复使用”;选择例外策略“;骡子,mule,Mule,在Mule flow中,如何在多个流中重复使用choice exception Streegy? 我尝试了以下方法,但在运行mule应用程序时,它抛出了错误 <mule ....> <choice-exception-strategy doc:name="My_exception_strategy"> <catch-exception-strategy when="exception.causedBy(java.net.SocketTimeoutExce

在Mule flow中,如何在多个流中重复使用choice exception Streegy? 我尝试了以下方法,但在运行mule应用程序时,它抛出了错误

<mule ....>
<choice-exception-strategy doc:name="My_exception_strategy">
      <catch-exception-strategy when="exception.causedBy(java.net.SocketTimeoutException)"   doc:name="Strategy1">
      <logger message="message 1" level="INFO" doc:name="Logger"/>
      </catch-exception-strategy>
      <catch-exception-strategy when="exception.causedBy(java.lang.Throwable)" doc:name="Strategy2">
      <logger message="message 2" level="INFO" doc:name="Logger"/>
      </catch-exception-strategy>
  </choice-exception-strategy>

<flow name="Test1" doc:name="Test1" processingStrategy="synchronous">
    <logger message="message 3" level="INFO" doc:name="Logger"/>
    <outbound-endpoint ref="myendpoint" doc:name="MyEndPoint"/> 
    <exception-strategy ref="My_exception_strategy" doc:name="Reference Exception Strategy"/>
    <set-variable variableName="somevalue" value="#[something]" doc:name="statusCode"/>
</flow>
</mule>   

您发布的配置有两个问题

  • 异常策略之后有一个“set变量”。在“异常策略”之后,不需要其他处理器

  • 异常策略未命名。异常策略缺少属性“name”

  • 尝试以下流程

    <mule ....>
    <choice-exception-strategy name="my_exception_strategy" doc:name="My_exception_strategy">
          <catch-exception-strategy when="exception.causedBy(java.net.SocketTimeoutException)"   doc:name="Strategy1">
          <logger message="message 1" level="INFO" doc:name="Logger"/>
          </catch-exception-strategy>
          <catch-exception-strategy when="exception.causedBy(java.lang.Throwable)" doc:name="Strategy2">
          <logger message="message 2" level="INFO" doc:name="Logger"/>
          </catch-exception-strategy>
      </choice-exception-strategy>
    
    <flow name="Test1" doc:name="Test1" processingStrategy="synchronous">
        <logger message="message 3" level="INFO" doc:name="Logger"/>
        <outbound-endpoint ref="myendpoint" doc:name="MyEndPoint"/> 
        <exception-strategy ref="my_exception_strategy" doc:name="Reference Exception Strategy"/>
    </flow>
    </mule> 
    
    
    

    希望这能有所帮助。

    您能否分享尝试运行应用程序时遇到的错误?