我正在使用WSO2 Enterprise Integrator 6.1.1 。我正在使用 VFS 从一个目录轮询文件并移动到另一个目录。但是我的代理服务正在制作一个锁定文件,并且无法移动该文件。我最初认为这是一个文件权限问题,但是当我使用 Inbound Endpoint 或我在代理服务中调用的自定义 java 中介尝试它时。然后文件被成功移动。
锁定文件:
代理服务代码:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestCSVFileMoving"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="vfs">
<target>
<inSequence>
<log level="full"
separator=",========----------Test CSV File Proxy Triggered------======="/>
</inSequence>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">30</parameter>
<parameter name="transport.vfs.FileURI">vfs:file:///files/uploads</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:file:///opt/file/con/Fail</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">Test.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:file:///opt/file/con/Out</parameter>
<description/>
</proxy>
错误日志:
TID: [-1234] [] [2018-01-10 12:51:56,634] ERROR {org.apache.synapse.transport.vfs.VFSTransportListener} - File object 'file:///files/uploads/Test.csv'cloud not be moved, will remain in "locked" state {org.apache.synapse.transport.vfs.VFSTransportListener}
org.apache.axis2.AxisFault: Error moving file : file:///files/uploads/Test.csv to file:///opt/file/con/Out
at org.apache.axis2.transport.base.AbstractTransportListener.handleException(AbstractTransportListener.java:343)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:682)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:499)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename "file:///files/uploads/Test.csv" because it is read-only.
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1087)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:680)
... 8 more
问题陈述:
我的问题是,在错误日志中,它明确指出它是一个只读文件。但是为什么通过使用入站端点和调用自定义调解器我可以移动文件。但仅使用 VFS 我收到此错误?还有有什么办法可以解决。如果我必须使用 VFS。