2013-02-11 2 views
0

낙타. 파일 구성 요소. 오류가 발생하지 않은 경우에만 파일을 복사하도록 경로를 구성해야합니다. 내가 무엇을 가지고 :조건이 참일 경우 파일 복사

<route id="importFile" autoStartup="{{fdr.import.enabled}}"> 
      <from uri="direct:startImportFile"/> 
      <from uri="file://{{fdr.folder.working}}?delete=true&amp;readLock=changed"/> 
      <transacted ref="fdrTxRequired"/> 
      <doTry> 
       <to uri="file://{{fdr.folder.done}}"/> <!--1--> 
       <bean ref="transactionsProcessor"/> 
       <bean ref="transactionsFinalizer"/> 
       <!--2--> 
       <doCatch> 
        <exception>java.lang.Exception</exception> 
        <to uri="file://{{fdr.folder.failed}}"/> 
        <bean ref="exceptionProcessor"/> 
       </doCatch> 
       <doFinally> 
        <bean ref="responsePublisher"/> 
       </doFinally> 
      </doTry> 
     </route> 

필요한 논리 : everething이 transactionsProcessor 및 transactionsFinalizer에 확인 처리 된 경우 다음 우리가 오류가 다음 transactionProcessor 또는 transactionsFinalizer에 발생하는 경우 우리가 이동 '완료'폴더에 '작업'폴더에서 파일을 이동 'working'에서 'failed'및 'done'파일이 비어 있어야합니다. 행 1을 자리 표시 자 2에 저장하면 사용자 정의 프로세서에서 처리 한 후 파일을 InputStream으로 재배치 할 수 없습니다. 어쩌면 우리는 '일하는'에서 '끝내기'로 이동할 수 있습니다. 그런 다음 ok를 누른 다음 ok를 입력하면 파일을 처리합니다. 오류가 발생하면 '완료'에서 '실패'로 이동하십시오. 도움말 pls.

답변

0

OU, 나는 해결책을 발견 - stopOnExeption와 멀티 캐스트

<routeContext id="fileImportOnlyRouteContext" xmlns="http://camel.apache.org/schema/spring"> 
     <route id="importFile" autoStartup="{{fdr.import.enabled}}"> 
      <from uri="direct:startImportFile"/> 
      <from uri="file://{{fdr.folder.working}}?delete=true&amp;readLock=changed"/> 
      <transacted ref="fdrTxRequired"/> 
      <doTry> 
       <multicast stopOnException="true"> 
        <to uri="direct:startFileImporter"/> 
        <to uri="file://{{fdr.folder.done}}"/> 
       </multicast> 
       <doCatch> 
        <exception>java.lang.Exception</exception> 
        <to uri="file://{{fdr.folder.failed}}"/> 
        <bean ref="exceptionProcessor"/> 
       </doCatch> 
       <doFinally> 
        <bean ref="responsePublisher"/> 
       </doFinally> 
      </doTry> 
     </route> 

     <route id="fileImporterRoute"> 
      <from uri="direct:startFileImporter"/> 
      <bean ref="transactionsProcessor"/> 
      <bean ref="transactionsFinalizer"/> 
     </route> 
    </routeContext> 
관련 문제