2013-06-03 139 views
0

我有簡單的代理髮送消息到一些網址。我想知道什麼時候通過代理髮送,什麼時候發送迴應。WSO2 ESB登錄代理

<?xml version="1.0" encoding="UTF-8"?> 
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SynchronizeService" transports="https http" startOnLoad="true" trace="disable"> 
    <target> 
    <inSequence> 
     <log level="simple"/> 

     <send> 
     <endpoint key="SynchronizeServiceEndpoint"/> 
     </send> 
    </inSequence> 

    <outSequence> 
     <log level="simple"/> 

     <send/> 
    </outSequence> 
    </target> 
</proxy> 

我添加了日誌中介,但問題是,它不記錄任何允許連接請求和響應的信息。所以示例日誌如下所示:

[2013-06-03 15:38:07,914] INFO - LogMediator To: http://esb-ip:9763/services/SynchronizeService, WSAction: http://test.pl/WebService/getWorkPlan, SOAPAction: http://test.pl/WebService/getWorkPlan, ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:36b60af3-dc30-4004-a239-26523774f52b, Direction: request 

[2013-06-03 15:38:08,016] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , ReplyTo: http://www.w3.org/2005/08/addressing/anonymous, MessageID: urn:uuid:8f753934-c64a-4276-a916-dceaeda3def0, Direction: response 

在記錄的響應中沒有關於SOAPAction的信息,messageIds是不同的。如何將請求與日誌中的響應連接起來?我想知道何時發送回覆。我怎樣才能做到這一點?

回答

2

我不知道可以在輸入序列中分配變量並在輸出序列中使用它們。我從輸入序列中分配messageId並將其記錄在輸出中。我的代理更改後看起來像:

<?xml version="1.0" encoding="UTF-8"?> 
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SynchronizeService" transports="https http" startOnLoad="true" trace="disable"> 
    <target> 
     <inSequence> 
      <log level="simple"/> 

      <property name="requestSysDate" expression="get-property('SYSTEM_DATE')" scope="default" type="STRING"/> 
      <property name="requestMsgId" expression="get-property('MessageID')" scope="default" type="STRING"/> 

      <filter xmlns:procsyn="http://test.pl/WebService/Synchronize" xpath="//procsyn:getWorkPlanIn"> 
       <property name="requestMethod" value="getWorkPlan" scope="default" type="STRING"/> 
      </filter> 

      <send> 
       <endpoint key="SynchronizeServiceEndpoint"/> 
      </send> 
     </inSequence> 

     <outSequence> 
      <log level="custom"> 
       <property name="proxyName" value="SynchronizeService"/> 
       <property name="requestMethod" expression="get-property('requestMethod')"/> 
       <property name="requestSysDate" expression="get-property('requestSysDate')"/> 
       <property name="requestMsgId" expression="get-property('requestMsgId')"/> 
      </log> 

      <send/> 
     </outSequence> 
    </target> 
</proxy> 
2

你做了一個簡單的日誌,它將記錄關於該消息的非常基本的信息。做一個日誌級別=滿,這將記錄通過系統傳遞的完整消息

+0

但「完整」日誌只添加消息正文,我對它不感興趣。我想知道什麼時候消息是發送低谷代理和當這個輸入消息的迴應發回。 – Kendzi

+0

在這種情況下,請在日誌中介中添加屬性以讀取系統時間。請參閱這篇文章http://vvratha.blogspot.com/2011/11/getting-system-time-within-mediation.html – Ratha

+0

感謝這幾乎是我需要的。 – Kendzi