2017-07-25 11 views
0

私はファイルを作成するために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>エラー・タイムアウトのない呼び出しメディエーター

質問:保存に失敗したときにコールメディエータからエラーメッセージを受け取る方法は?

ありがとうございます!

答えて

0

フォールトシーケンスまたはエラーハンドラを作成しようとしましたか?

あなたは、プロキシサービスの障害シーケンスを追加することができます。

<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

関連する問題