0

zip ファイルのディレクトリを監視し、Camel と Spring DSL を使用して zip ファイル内のファイルを個別に処理したいと考えています。次のようなことは可能ですか?

<camel:route>
  <camel:from uri="file:/src/Path/"/>
  <camel:split streaming="true">
    <zipSplit/>
    <camel:to uri="bean:fileProcessor?method=processStream"/>
  </camel:split>
</camel:route>

わかりましたので、次は1つのファイルを含むzipファイルに対して機能することがわかりましたが、問題は、複数のファイルを含むzipファイルをどのように処理できるかです?

<bean id="zipFileDataFormat" class="org.apache.camel.dataformat.zipfile.ZipFileDataFormat"/>

<camel:camelContext>
    <camel:contextScan/>
    <camel:route>
        <camel:from uri="file:///C:/testSrc/?delay=6000&noop=true&idempotent=false"/>
        <camel:unmarshal ref="zipFileDataFormat"/>
        <camel:to uri="file:///C:/testDst"/>
    </camel:route>
</camel:camelContext>

ファイルは、別のディレクトリに解凍されたばかりの処理のために Bean に送信されていないことに注意してください。

4

1 に答える 1

5

これは機能します。log 要素が詳細を提供することに注意してください。

<bean id="zipFileDataFormat" class="org.apache.camel.dataformat.zipfile.ZipFileDataFormat">
    <property name="usingIterator" value="true"/>
</bean>

<camel:camelContext>
    <camel:contextScan/>
    <camel:route id="unzipMultipleFiles">
        <camel:from uri="file:///C:/testSrc/?delay=30000&amp;noop=true&amp;idempotent=false"/>
        <camel:unmarshal ref="zipFileDataFormat"/>
        <camel:split streaming="true">
            <camel:simple>${body}</camel:simple>
            <camel:to uri="log:org.apache.camel?level=INFO&amp;showAll=true&amp;multiline=true"/>
            <camel:to uri="file:///C:/testDst"/>
        </camel:split>
    </camel:route>
</camel:camelContext>
于 2013-08-26T01:38:37.357 に答える