2012-03-26 95 views
0

好吧,仍然忙於使用MySQL文件使用者的文件。我開始遇到某些大文件的錯誤,並希望將它們發送到另一條路徑進行處理。所以這個想法是一個簡單的基於內容的路由器,它將查看文件大小,如果它是一個大文件,則將其複製到另一個目錄並保留在那裏(再次簡單瞭解如何執行此操作)。如何根據Apache Camel中的大小路由文件

所以我開始閱讀關於CBR以及如何在我的駱駝環境中使用簡單的表達式語言。所以我添加了一個CBR到camel-context.xml文件,現在我甚至不能運行任何路由。構建失敗,出現以下錯誤:

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
Line 48 in XML document from class path resource [META-INF/spring/camel-context.xml] is invalid; 
nested exception is org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup. 

右鍵所以很明顯,我得到了一些不好的XML在那裏,但對我的生活我不能似乎可能找到問題的一些較有經驗的車友可以給我一些通過快速瀏覽我的xml文件,在此建議。

<errorHandler id="defaultEH" type="DefaultErrorHandler"> 
     <redeliveryPolicy 
       maximumRedeliveries="5" 
       retryAttemptedLogLevel="WARN" 
       backOffMultiplier="1" 
       useExponentialBackOff="true"/> 
    </errorHandler> 
    <threadPoolProfile id="myDefaultProfile" 
     defaultProfile="true" 

     maxPoolSize="16"/> 

     <threadPool id="myPool" threadName="Cool" poolSize="4" maxPoolSize="4" maxQueueSize="100"/> 
     <route handleFault="true"> 


      <from uri="file://c:/CTest/BadFiles?noop=true&amp;recursive=true&amp;delay=3000"/> 
      <choice> 
      <when> 
       <simple>${file:length}<20000000</simple> 
       <threads executorServiceRef="myPool"> 
        <to uri="bean://fileToSQL"/> 
       </threads> 
      </when> 
      <otherwise> 

       <to uri="file://c:/CTest/outbox"/> 

       <stop/> 
      </otherwise> 
      </choice> 
      <!--<to uri="jdbc://timlogdb"/>--> 

     </route> 

我到處看着,根據我的理解,這應該是有效的XML。

回答

1

我認爲你需要逃避文本中的大於號;這是XML限制。 此外,簡單的語言要求您在其操作員周圍使用空間。所以它應該是

<simple>${file:length} &lt; 20000000</simple> 
+0

我認爲這是愚蠢的。今天工作太多的人認爲是冰冷啤酒的時候了。謝謝 – Namphibian 2012-03-26 14:29:26

相關問題