呼叫中介没有错误超时

问题描述:

我有呼叫调解员与VFS里面创建文件。当保存失败时(没有权限),我没有收到超时错误或其他东西来理解这一点。这是从顺序的一部分: <property description="Concat path" expression="fn:concat('vfs:file:///',get-property('BPath'),'/',get-property('dynamic'),'/wso2.file')" name="Path" scope="default" type="STRING"/> <header expression="get-property('Path')" name="To" scope="default"/> <property description="OUT_ONLY=true" name="OUT_ONLY" scope="default" type="STRING" value="true"/> <call description=""> <endpoint> <default/> </endpoint> </call>呼叫中介没有错误超时

问题是:如何保存失败时从调解员获取错误消息?

在此先感谢!

您是否尝试过创建错误序列或错误处理程序?

您可以添加一个故障序列的代理服务:

<faultSequence> 
     <sequence key="conf:sequences/common/ErrorHandlerSeq.xml"/> 
</faultSequence> 

或者定义错误处理程序的顺序:

<sequence name="mySequence" onError="conf:sequences/common/ErrorHandlerSeq.xml"> 
... 
</sequence> 

然而,错误WSO2处理的情况比较特殊,您的调解器可能需要将异常包装到SynapseException中,以使其触发错误处理程序。

UPDATE

继评论,它看起来是一个众所周知的问题,在WSO2处理错误。罪魁祸首是ProxyServiceMessageReceiver.class从突触核心,具有以下行:

/*  */  catch (SynapseException syne) 
/*  */  { 
/* 193 */  if (!synCtx.getFaultStack().isEmpty()) { 
/* 194 */   warn(traceOn, "Executing fault handler due to exception encountered", synCtx); 
/* 195 */   ((FaultHandler)synCtx.getFaultStack().pop()).handleFault(synCtx, syne); 
/*  */  } 
/*  */  else { 
/* 198 */   warn(traceOn, "Exception encountered but no fault handler found - message dropped", synCtx); 
/*  */  } 
/*  */  } 
/*  */  finally { 
/* 202 */  StatisticsReporter.endReportForAllOnRequestProcessed(synCtx); 
/*  */  } 

明显的问题这里只触发时SynapseException被捕获的错误处理,其他人都被忽略。

如果您可以更新WSO2实例的类,则可以使其捕获所有异常。

我改变了这段代码有以下几点:

/*  */  catch (Exception syne) 
/*  */  { 
/* 193 */  log.error("Exception caught on mediation sequence", syne); 
      if (!synCtx.getFaultStack().isEmpty()) { 
/* 194 */   warn(traceOn, "Executing fault handler due to exception encountered", synCtx); 
       try { 
/* 195 */   ((FaultHandler)synCtx.getFaultStack().pop()).handleFault(synCtx, syne); 
       } catch (Exception ex) { 
        log.error("Exception caught while executing fault handler", ex); 
        //warn(traceOn, "Exception caught while executing fault handler", synCtx); 
        if (!synCtx.getFaultStack().isEmpty()) { 
         warn(traceOn, "Executing nested fault handler", synCtx); 
         try { 
          ((FaultHandler)synCtx.getFaultStack().pop()).handleFault(synCtx, ex); 
         } catch (Exception e) { 
          log.error("Exception caught while executing nested fault handler, mediation stopped", e); 
         } 
        } else { 
         warn(traceOn, "No nested fault handler found - message dropped", synCtx); 
        } 
       } 
/*  */  } 
/*  */  else { 
/* 198 */   warn(traceOn, "Exception encountered but no fault handler found - message dropped", synCtx); 
/*  */  } 
/*  */  } 

它允许使用甚至嵌套的错误处理,这是不工作的开箱的,据我所知。

+0

是的,我有一个故障序列(尝试两种变体),但在这种情况下,它没有运行。代理返回空白结果() – awc

+0

已更新anwser与我的错误处理修复程序 – user3714601