2017-04-12 19 views
0

我想开发一个流程,可以使我能够查询可能需要很长时间才能返回的外部系统。我可能不得不查询列表中的多个值。我正在使用一个直到成功的范围来解决问题。不幸的是,即使请求运行了好几次,失败的记录也不会被放入死信队列中。这里是我解决问题的尝试:直到 - 成功处理长时间运行的查询中的对象列表不起作用

<!-- Dead Letter Queue for exhausted attempts--> 
    <vm:endpoint name="DLQ" path="DLQ_VM" doc:name="VM"/> 

    <flow name="StartFlow" processingStrategy="synchronous"> 
     <!--Place a list of String errors to query for on this vm --> 
     <vm:inbound-endpoint path="request-processing-queue" " 
         exchange-pattern="one-way" doc:name="VM"/> 
      <vm:outbound-endpoint path="reprocessing-queue" 
         exchange-pattern="request-response" doc:name="VM"/> 
      <logger level="INFO" message="Data returned is #[payload]"/> 
      <catch-exception-strategy> 
      <logger level="ERROR" message="Failure During Processing"/> 
      </catch-exception-strategy> 
    </flow> 



    <flow name="RetryingProcess"> 
     <vm:inbound-endpoint name="reprocessing-vm" exchange- 
               pattern="request-response" 
           path="reprocessing-queue" doc:name="VM"/> 
     <foreach collection="#[payload]" doc:name="For Each"> 
      <vm:outbound-endpoint path="by-singles-vm" exchange- 
          pattern="request-response"/> 
     </foreach> 
    </flow> 


     <flow name="query-retry"> 
      <vm:inbound-endpoint path="by-singles-vm" exchange- 
    pattern="request-response" doc:name="VM"/> 
      <until-successful objectStore-ref="objectStore" 
         failureExpression="#[groovy:(exception &amp;&amp; 
       exception in com.trion.CustomException) 
             ||!(payload instanceof 
        com.trion.QueryResult])]" 
         maxRetries="5" 
         millisBetweenRetries="300000" 
         deadLetterQueue-ref="DLQ_VM" doc:name="Until 
                 Successful"> 
        <vm:outbound-endpoint path="try-again-vm" exchange- 
      pattern="request-response" doc:name="VM"/> 
      </until-successful> 
     </flow> 
    <flow name="GetQueryValue" > 
      <vm:inbound-endpoint path="try-again-vm" exchange- 
      pattern="request-response" doc:name="VM"/> 
      <flow-ref name="QueryRequest" /> 
    </flow> 

<!-- This never happens, i.e. the results are not put here... after retying 
         --> 
    <flow name="AttemptsExceededProcessing"> 
    <inbound-endpoint ref="DLQ_VM" doc:name="Generic"/> 
    <logger level="DEBUG" message="Entering Final Destination Queue with 
     payload is #[payload]"/> 
    </flow> 

    <!-- Here I have a query to the external system... > 
    <flow name="QueryRequest"> 
     ...... Makes the long running query Here.. 
    //returns com.trion.QueryResult 
     </flow> 
    </mule> 

请帮忙!

回答

0

配置没有问题。我有一个millisSecondsBetweenRetry值设置得这么小,我没有看到日志消息,并认为它没有工作。