我有 Spring 集成管道,它从 SFTP 服务器获取文档并将其保存到 Postgresql 数据库(由 Spring data/hibernate 完成)。成功后 sftp 获取管道获取文件名和内容(如 byte[])并将其保存到数据库。
我有两个主要问题:
问题是我没有预料到客户端会上传 100Mb - 200MB 的 zip 文件,管道读取但无法持久保存。
有时(不总是)抛出“java.lang.OutOfMemoryError:Java heap space”,但增加的堆内存暂时解决了这个问题,也许有解决方案不需要在持久保存到数据库之前将整个文件内容加载到内存?
仅记录事务期间记录的消息:
"thread":"task-scheduler-8","location":"org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer.copyFileToLocalDirectory(AbstractInboundFileSynchronizer.java:430)","level":"WARN","message":"The remote file '-r-x------ 1 0 0 81062125 May 15 15:06 test.zip' has not been transferred to the existing local file './transfered-files/test.zip'. Consider removing the local file."}
我明白我应该分享代码,但真的不能(法律问题)。
PIPIONE
相关分类