2015-05-27 23 views
1
<flow..> 
    ... 
    <jersey:resources doc:name="REST"> 
      <component class="com.rest.SyncAccountService"/> 
    </jersey:resources> 
    <set-payload value="#[message.payload]" doc:name="Set Payload"/> 
    <set-property propertyName="mimeType" value="application/octet-stream" doc:name="Property"/> 
    <set-property propertyName="Content-Disposition" value="attachment;filename=${file_name}" doc:name="Property"/> 
    <set-variable variableName="status" value="Success" doc:name="Status"/> 
    <flow-ref name="audit" doc:name="audit"/> 
</flow> 

<flow name="audit" doc:name="audit"> 
    <http:inbound-endpoint exchange-pattern="request-response" host="${hostname}" port="${glport}" path="audit" doc:name="HTTP"/> 
    <db:insert config-ref="QB_Oracle_Configuration" doc:name="Audit" transactionalAction="NOT_SUPPORTED"> 
     <db:parameterized-query><![CDATA[INSERT INTO SIAS_AUDIT(ACCESS_ID,EMPLID) VALUES('1','value1')]]></db:parameterized-query> 
    </db:insert> 
    <set-payload value="===Audit Log ===" name="AuditStatus" doc:name="Status"/> 
</flow> 

上面的代碼工作正常,但它返回===審計日誌===在下載的文件中。取而代之,我需要顯示在靜態組件處生成的附件級別定義的有效負載。Mule附件返回值

審計流程的目的是記錄數據庫中成功/失敗的狀態,它不應該返回任何東西。如果我刪除<set-payload value="===Audit Log ===" name="AuditStatus" doc:name="Status"/>

它開始返回java.lang.Number中

編輯

獲得以下錯誤,使得它作爲異步後:

ERROR 2015-05-27 13:43:51,846 [[qbiif].connector.http.mule.default.receiver.02] org.mule.exception.CatchMessagingExceptionStrategy: 
******************************************************************************** 
Message    : Unable to process a synchronous event asynchronously. Message payload is of type: MuleResponseWriter$1 
Code     : MULE_ERROR--2 
-------------------------------------------------------------------------------- 
Exception stack is: 

    1. Unable to process a synchronous event asynchronously. Message payload is of type: MuleResponseWriter$1 (org.mule.api.MessagingException) 
     org.mule.processor.AsyncInterceptingMessageProcessor:132 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) 
    -------------------------------------------------------------------------------- 
    Root Exception stack trace: 
    org.mule.api.MessagingException: Unable to process a synchronous event asynchronously. Message payload is of type: MuleResponseWriter$1 

流量的變化:

<flow name="audit" doc:name="audit" processingStrategy="asynchronous"> 
    <db:insert config-ref="QB_Oracle_Configuration" doc:name="Audit" transactionalAction="NOT_SUPPORTED"> 
     <db:parameterized-query><![CDATA[INSERT INTO SIAS_AUDIT(ACCESS_ID,EMPLID) VALUES('1','value1')]]></db:parameterized-query> 
    </db:insert> 
    <set-payload value="===Audit Log ===" name="AuditStatus" doc:name="Status"/> 
</flow> 

EDIT-2

最終爲以下link

<flow name="audit" doc:name="audit"> 
    <async> 
     <db:insert config-ref="QB_Oracle_Configuration" doc:name="Audit" transactionalAction="NOT_SUPPORTED"> 
      <db:parameterized-query><![CDATA[INSERT INTO SIAS_AUDIT(ACCESS_ID,EMPLID) VALUES('1','value1')]]></db:parameterized-query> 
     </db:insert> 
     <set-payload value="===Audit Log ===" name="AuditStatus" doc:name="Status"/> 
    </async> 
</flow> 
+0

「審計」流程中「http:inbound-endpoint」的用途是什麼?你打算直接通過HTTP調用這個流程嗎? –

+0

@DavidDossot,將其刪除。不需要。 – bekur

回答

1
  • 刪除<set-payload value="#[message.payload]" doc:name="Set Payload"/>後工作的代碼的變化:它設置消息淨荷本身,這是無用的。
  • <flow-ref name="audit" doc:name="audit"/>包裝在async範圍內,以便它的響應不會與來自JAX-RS組件的響應混淆。
  • 除非您確實需要通過HTTP公開audit流,否則請將其中的http:inbound-endpoint刪除。
+0

刪除了http入站端點和有效負載。在對異步錯誤進行更改之後,無法異步處理同步事件。上面更新的問題 – bekur

+0

明白了,用 bekur