2012-03-26 46 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

相关问题