camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From demetrios <demetrios.rap...@dstglobalsolutions.com>
Subject consumerTemplate.receive function on same file hanging.
Date Thu, 01 Nov 2012 03:55:04 GMT
Hi All
I am new to camel and currently have an issue with a fileConsumer I have
built.

I am using camel to read in a message file via a route.  As part of this I
am using the body received in this file to read to acquire a file location
defined in the body.    I then want camel to take this value and read in a
new body from another file.

Here is what my consumer routine looks like:

    public void hello(@Header("Camel.File") String filePath, @Body String
body, Exchange exchange){
        int lastSlash =
filePath.lastIndexOf(System.getProperty("file.separator"));
        String path = filePath.substring(0, lastSlash);
        String fileName = filePath.substring(1+lastSlash);
        Exchange newExchange =
consumerTemplate.receive("file:"+path+"?fileName="+fileName)
        exchange.getIn().setBody(newExchange.getIn().getBody());

    }

This works fine one the first run for a particular file however if I want to
reprocess that message in the same instance to the same file, the call :
consumerTemplate.receive("file:"+path+"?fileName="+fileName)
hangs.

I have debugged into the receive call and it seems that the file read in
earlier is still locked by the previous run.

Does anyone have any ideas on what I am missing here?



--
View this message in context: http://camel.465427.n5.nabble.com/consumerTemplate-receive-function-on-same-file-hanging-tp5721925.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message