I tried to do something very simple:
from("file://" + inputDirectory +
"?recursive=true&readLock=none&delete=true").to("activemq:queue:QUEUE);

I received many error message saying that the file cannot be deleted. 

After some investigation, it seems the file is still open...

I found out the following in IOConverter:(used by the JMS when sending to
the queue)

@Converter 
175     public static byte[] toByteArray(File file) throws IOException {
 
176         return toBytes(toInputStream(file));
 
177     }
 

If I do the following, it works as expected:
@Converter
  public static byte[] toByteArray(File file) throws IOException
  {
    InputStream inputStream = toInputStream(file);
    try
    {
      return toBytes(inputStream);
    }
    finally
    {
      inputStream.close();
    }
  }


Is this a bug ? 

Thank you
(CAMEL 2.1.0)
-- 
View this message in context: 
http://old.nabble.com/Problem-with-JMS-and-file-tp26857645p26857645.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to