【问题标题】:Using SystemCommandTasklet for split the large flat file into small files使用 SystemCommandTasklet 将大平面文件拆分为小文件
【发布时间】:2015-02-27 18:36:18
【问题描述】:

是否有人已经使用 Spring Batch SystemCommandTasklet 将大型平面文件拆分为小文件。

我想知道这个过程真的很耗时吗?

我们想将文件拆分为 1 亿条记录(每条记录包含 15 个字段)。

请在这方面提供任何帮助。

问候

香卡

【问题讨论】:

    标签: spring-batch flat-file


    【解决方案1】:

    我在 JSR-352、Spring Batch 和你 (https://www.youtube.com/watch?v=yKs4yPs-5yU) 的演讲中这样做了。在那里,我将SystemCommandTasklet 与 OS X 的 split 命令结合使用。您可以在此处查看该演讲的存储库中的示例配置:https://github.com/mminella/jsr352-springbatch-and-you

    具体例子如下:

    <bean id="fileSplittingTasklet" class="org.springframework.batch.core.step.tasklet.SystemCommandTasklet" scope="step">
        <property name="command" value="split -a 5 -l 10000 #{jobParameters['inputFile']} #{jobParameters['stagingDirectory']}"/>
        <property name="timeout" value="60000"/>
        <property name="workingDirectory" value="/tmp/jsr_temp"/>
    </bean>
    

    这是分割文件的首选方法。文件系统/操作系统级别的工具比通过 java 进程传输文件要快得多。

    【讨论】:

      猜你喜欢
      • 2020-10-26
      • 1970-01-01
      • 2016-09-20
      • 1970-01-01
      • 2021-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多