camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin11 <mato.kraj...@gmail.com>
Subject Random unsuccessful read from file
Date Mon, 02 Dec 2013 14:59:26 GMT
Hello,

I have a route triggered by timer where I read data (zulu time) from file
(using poolEnrich) and at the end of route I replace data in file for next
route iteration.

Now after deploy on server I found following problem:
- sometimes data are not loaded from file and poolEnrich return only 0x0a
(Line Feed) character! 
- from log I see that at the end of route valid data was ready for persist
into file
- I don`t understand why this happened after cca 200 successful iteration of
this route
- this anomaly happens 2 or 3 times per day (timer is set to 60s on server)
- there is no exception in log (Permission denied, Cannot store file, etc.)

Any idea why this could happen? Why pollEnrich read empty file? No other
process access to this new created file.
I use camel 2.11.0 and java 7.

Could not reproduce this problem on devel environment:

<camel:endpoint id="timeFile"
uri="file://{{working.folder}}/?fileName=filename.time&amp;noop=true&amp;idempotent=false&amp;readLock=none&amp;sendEmptyMessageWhenIdle=true&amp;fileExist=Override"/>
<camel:routeContext id="testRoutes">
    <camel:route id="route-test-file">
        <camel:from
uri="timer://test?fixedRate=true&amp;period=1s&amp;delay={{timer.delay}}"/>
        <camel:pollEnrich ref="timeFile" strategyRef="enrichAggregation"/>
        <camel:log message="Data from file:${body}"/>
        <camel:convertBodyTo type="java.lang.String" />
        
        <camel:transform>
            <camel:groovy>request.body != null ? request.body.trim() :
null</camel:groovy>
        </camel:transform>
        ...        
        ...
        ...
        <camel:setBody>
            <camel:constant>20131130125927Z/camel:constant>
        </camel:setBody>
        <camel:log message="Save data to file:${body}"/>
        <camel:to ref="timeFile"/>
    </camel:route>
</camel:routeContext>

/**
 * Enrich aggregator strategy implementation.
 * It keep original exchange message with all headers and properties
 * and only replace body with new value.
 */
public class EnrichAggregationStrategy implements AggregationStrategy {

    @Override
    public Exchange aggregate(Exchange originalExchange, Exchange
newExchange) {
        if (originalExchange == null) {
            originalExchange = newExchange;
        } else {
            originalExchange.getIn().setBody(newExchange.getIn().getBody());
        }

        return originalExchange;
    }
}

Thanks for some hint.



--
View this message in context: http://camel.465427.n5.nabble.com/Random-unsuccessful-read-from-file-tp5744181.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message