使用 Apache Camel 读取和拆分大文件

问题描述 投票:0回答:0

我正在尝试使用 Camel 读取一个大约 1 GB 的非常扁平的文件。记录由一组字符串分隔,我正在尝试以下路线。

from(incomingFilePath+"?delete=true")
                .split()
                .tokenize(RECORD_SEPARATOR)
                .streaming()
                .bean(bean, "method")
                .bean(bean,"method")
                .end();

流媒体在上述情况下有效。但是当我尝试使用正则表达式进行标记化时,我的流式传输失败并且出现内存不足异常。

from(incomingFilePath+"?delete=true")
                .split()
                .tokenize(RECORD_SEPARATOR_REGEX, true)
                .streaming()
                .bean(bean, "method")
                .bean(bean,"method")
                .end();

java.lang.OutOfMemoryError: Java heap space

一些参考资料:

java apache-camel
© www.soinside.com 2019 - 2024. All rights reserved.