I have a simple mule flow that streams a csv file to a custom java component. I need to be able to handle large files so don't want to use a Transformer that reads the file to memory.
Currently, I get the following error: "Failed to delete file "C:\temp\input\inputCSV.csv" as part of the file move operation. The file was being deleted because AutoDelete was set on the file connector."
Changing the mule XML config Autodelete="false" and specifying a destination directory for the 'processed' file results in a similar error. Could someone tell me how to stream the file and postpone autodeletion until the file has been read fully? I'm calling .close() on my mule payloadStream, when I'm done, but mule seems to be completing the file deletion too early!
Here's the flow XML config...
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<spring:beans>
<spring:import resource="classpath*:/spring/config.xml" />
<spring:import resource="classpath*:/spring/extras/Rule-preprocessor-config.xml" />
</spring:beans>
<file:connector name="fileInput" streaming="true"
autoDelete="true"
moveToPattern="#[message.inboundProperties['originalFilename']]"
doc:name="File">
<!-- <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" /> -->
</file:connector>
<flow name="stringflowFlow2x" doc:name="stringflowFlow2x">
<file:inbound-endpoint connector-ref="fileInput"
path="/temp/input" doc:name="inputCsv" responseTimeout="10000" fileAge="10000" />
<component class="com.benji.FileImportPreProcessor" doc:name="JavaPreProcessorLogic"/>
<logger message="Finished!" level="INFO" doc:name="Logger"/>
</flow>
</mule>