Apache camel 使用ApacheCamel从CSV和XML文件中读取大量数据

Apache camel 使用ApacheCamel从CSV和XML文件中读取大量数据,apache-camel,Apache Camel,是否可以使用ApacheCamel读取大量数据CSV和XML文件(每个文件大约超过1GB) 如果本例涉及任何性能问题或限制,Apache Camel提供什么样的解决方案。关于csv的答案在这里 对于使用大型xml文件,可以使用 关于csv的答案在这里 对于使用大型xml文件,可以使用 在分析问题后,我找到了以下解决方案 因此,如果我们能简单地在骆驼上花费足够的内存,1GB就不是那么多了 这取决于以下问题 我们需要同时使用1GB来访问还是以任何顺序访问所有文件 如果没有,那么我们将不得不“流化

是否可以使用ApacheCamel读取大量数据CSV和XML文件(每个文件大约超过1GB

如果本例涉及任何性能问题或限制,Apache Camel提供什么样的解决方案。

关于csv的答案在这里

对于使用大型xml文件,可以使用 关于csv的答案在这里

对于使用大型xml文件,可以使用

在分析问题后,我找到了以下解决方案

因此,如果我们能简单地在骆驼上花费足够的内存,1GB就不是那么多了

这取决于以下问题

我们需要同时使用1GB来访问还是以任何顺序访问所有文件

如果没有,那么我们将不得不“流化”CSV/XML文件,以InputStream的形式读取,然后依次获得所需的内容

CSV:

<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
    <from uri="direct:start"/>
    <split streaming="true">
        <tokenize token="\n"/>
        <to uri="mock:result"/>
    </split>
     <unmarshal><csv /></unmarshal>
</route>
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>    
    <from uri="direct:start"/>
    <split streaming="true">     
       <ref>staxRecord</ref>     
      <to uri="mock:result"/>
    </split>
  </route>
</camelContext>

XML:

<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
    <from uri="direct:start"/>
    <split streaming="true">
        <tokenize token="\n"/>
        <to uri="mock:result"/>
    </split>
     <unmarshal><csv /></unmarshal>
</route>
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>    
    <from uri="direct:start"/>
    <split streaming="true">     
       <ref>staxRecord</ref>     
      <to uri="mock:result"/>
    </split>
  </route>
</camelContext>

史达克斯唱片

分析问题后,我找到了以下解决方案

因此,如果我们能简单地在骆驼上花费足够的内存,1GB就不是那么多了

这取决于以下问题

我们需要同时使用1GB来访问还是以任何顺序访问所有文件

如果没有,那么我们将不得不“流化”CSV/XML文件,以InputStream的形式读取,然后依次获得所需的内容

CSV:

<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
    <from uri="direct:start"/>
    <split streaming="true">
        <tokenize token="\n"/>
        <to uri="mock:result"/>
    </split>
     <unmarshal><csv /></unmarshal>
</route>
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>    
    <from uri="direct:start"/>
    <split streaming="true">     
       <ref>staxRecord</ref>     
      <to uri="mock:result"/>
    </split>
  </route>
</camelContext>

XML:

<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
    <from uri="direct:start"/>
    <split streaming="true">
        <tokenize token="\n"/>
        <to uri="mock:result"/>
    </split>
     <unmarshal><csv /></unmarshal>
</route>
 <camelContext xmlns="http://camel.apache.org/schema/spring">
  <route>    
    <from uri="direct:start"/>
    <split streaming="true">     
       <ref>staxRecord</ref>     
      <to uri="mock:result"/>
    </split>
  </route>
</camelContext>

史达克斯唱片