You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Steppacher Ralf <ra...@derivativepartners.com> on 2013/08/12 18:08:33 UTC

File component does not delete file on error

Hello all,

we are reading files, in parallel, split them line by line and then asynchronously process every line. The result is sent off via ActiveMQ (5.8.0).
Once in a while we receive an error in the ActiveMQ client. Processing of the file seems to continue fine. Once the EOF is reached we get this in the log:

2013-08-12 15:49:46,738 WARN  org.apache.camel.component.file.GenericFileOnCompletion - Rollback file strategy: org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy@2cdfb4e9 for file: GenericFile[/var/ampa/inprogress/DP215-PRODUCTS-12082013_15_39_34.csv]

The .camelLock file is deleted, but the file itself remains in the "in progress" folder instead of being deleted as when there is no error during processing. I have tried Camel 2.10.3 and 2.10.5. Both behave the same.

Can anybody help me out and tell me what to set on the endpoint so that files are removed on error as well?


The  endpoint:
<endpoint id="fileBufferFrom" uri="file://${src.dir}/?sortBy=file:size&amp;delay=10000&amp;delete=true&amp;idempotent=true&amp;preMove=inprogress&amp;useFixedDelay=false&amp;maxMessagesPerPoll=5" />

The route:

<route id="process_from_file_buffer" startupOrder="11">
    <from ref="fileBufferFrom"/>
    <threads poolSize="5" maxPoolSize="5" keepAliveTime="60" timeUnit="SECONDS" maxQueueSize="50" threadName="file_consumer" rejectedPolicy="DiscardOldest">
        <convertBodyTo type="java.io.InputStream"/>
        <split streaming="true" parallelProcessing="true">
            <tokenize token="\r\n"/>
            <choice>
                <when>
                    <simple>${property.CamelSplitIndex} == 0</simple>
                    <stop/>
                </when>
                <otherwise>
                    <multicast parallelProcessing="false">
                        <to uri="direct:extractMsgType1"/>
                        <to uri="direct:extractMsgType2"/>
                        <to uri="direct:extractMsgType3"/>
                    </multicast>
                </otherwise>
            </choice>
        </split>
    </threads>
</route>

Thanks!
Ralf