I am working with Camel 2.22

I have a route with a pollEnrich, which I am utilizng readLock, because I don’t 
want to do the poll enrichment if the file is still being written.

Path:
from( 
"{{sourceFile}}?fileName=f1.txt&move=.done&moveFailed=.error&delay=5m&autoCreate=true&readLock=changed")
              
.pollEnrich("{{sourceFile}}?fileName=f2.txt&move=.done&moveFailed=.error&autoCreate=true&readLock=changed",ocas)


Where OCAS is an aggregation strategy:


         @Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {

    File f = newExchange.getIn().getBody(File.class);

    try {
        Reader r = new FileReader(f);
        CSVFormat format = 
CSVFormat.RFC4180.withHeader().withIgnoreSurroundingSpaces().withTrim().withDelimiter('|');
        Iterable<CSVRecord> records = format.parse(r);
                 for (CSVRecord record : records) {
…Do some processing to build the an obect I add as a property to the old 
exchange called VP…
    }
        r.close();
        }

         catch(Exception e){
           Log.info("EXCEPTIOIN "+e);
         }

      oldExchange.setProperty("VP",vp);
      newExchange.handoverCompletions(oldExchange);
      return oldExchange;
}


The pollenrichment works fine, but it is leaving the *.cameLock file around 
after the route is complete.  I am not sure about the handOverCompletions call, 
but found it mentioned while querying the problem.. but it doesn’t seem to have 
any impact one way or another.  The .camelLock file never gets deleted.

There are no other readers or streams opened in the AggregationStrategy or ther 
the Reader r which I explicitely close.

So, what should I be doing so Camel releases this readlock when its done?


.


Reply via email to