2016-12-06 84 views
0

需要從套接字()讀取數據,使用ibatis解析和寫入數據庫。這必須持續進行。不確定如何連續運行此過程。使用駱駝循環的想法。但它看起來像我們需要提及循環計數。在jboss保險絲上使用駱駝路由連續運行一個循環

<route id="vts-data"> 
    <from uri="timer://runOnce?repeatCount=1" /> 
    <doTry> 
     <loop> 
      <to uri="bean:vtsProcessor?method=extractLocations" /> 
      <log message="Details List is : ${body}" /> 
     </loop> 
     <choice> 
      <when> 
       <simple>${body.size} == 0</simple> 
       <log message="List is null ${body}" /> 
      </when> 
      <otherwise> 
       <to uri="mybatisPromis:insertLocationData?statementType=SelectList" /> 
       <log message="Details List is : ${body}" /> 
       <choice> 
        <when> 
         <simple>${body.size} == 0</simple> 
         <log message="Details List is null : ${body}" /> 
        </when> 
        <otherwise> 
         <log message="Details List is : ${body}" /> 
        </otherwise> 
       </choice> 
      </otherwise> 
     </choice> 
     <doCatch> 
      <exception>java.lang.Exception</exception> 
     </doCatch> 
     <doFinally> 
      <to uri="log:body" /> 
     </doFinally> 
    </doTry> 
</route> 

我是新來的駱駝和保險絲。認爲使用工作線程連續運行過程,但不是運氣。需要一些指針來做優化的方法。

回答

0

駱駝路線提供了「始終運行的過程」。它只是安排組件和EIP來滿足您的要求。

  1. 推薦的方法是從插座中的「從」

  2. 如果不是#1,你應該看看使用pollingConsumer模式..定時器運行..輪詢套接字端點讀..然後持續到ibatis的

REF:http://camel.apache.org/polling-consumer.html