Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-44

File poller component is not deleting input file and its lock from the folder (in the case of an exception)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.4.2.0-fuse
    • 1.4.0.0-fuse
    • None
    • None

      The file poller fails to remove a file from the input directory when an error occurs during processing of that file (see attached testcase)

      Notes:

      It seems that if we let the context stay up the right amount of time, both the file and its lock are removed.

      By removing the comment from the following Thread sleep line in the code, we're allowing the camel context to
      continue processing and apparently give time to cleanup the file and its lock.
      //Thread.sleep(10000);

      But if we don't remove the comment from above, the context stops immediately after the process message is done,
      the file and the lock file are not removed from the indir directory.

      Flow:


      This example polls a directory and tries to process the contents of the file
      and write them to the output directory.

      file poller -> [Processing fails ] -> output directory

      Setup:
      ------

      1) Software needed is: Fuse MR 1.4.0.0, ant, jdk 1.6

      These are the extra jars in my <testcase>\lib

      rw-rr- 1 rrojas staff 162796 Jul 8 15:00 junit-4.4.jar
      rw-rr-@ 1 rrojas staff 320272 Jul 8 15:24 org.apache.felix.framework-1.0.0.jar

      2) Set CAMEL_HOME=<root directory of Fuse MR>

      e.g (windows)

      >set CAMEL_HOME=c:\iona\fuse-mediation-router-1.4.0

      or for unix\mac
      >export CAMEL_HOME=/opt/iona/fuse-mediation-router-1.4.0

      3) Build testcase

      >ant compile

      4) Run testcase

      >ant test

      You should see output like this:

      	test:
           [echo] Running producer 
           [java] JUnit version 4.4
           [java] .Adding routes...
           [java] Write file and wait...
           [java] received message: FileMessage: indir/file.txt
           [java] 
           [java] Time: 1.559
           [java] 
           [java] OK (1 test)
           [java] 
           [java] Jul 8, 2008 4:39:41 PM org.apache.camel.processor.Logger log
           [java] SEVERE: Failed delivery for exchangeId: ID-rrojass-macbook-pro.local/59384-1215549580928/0-0. On delivery attempt: 0 caught: java.lang.Exception: failed to process file....
           [java] java.lang.Exception: failed to process file....
           [java] 	at com.iona.test.dev1008.CamelFilePollerTest$1$1.process(CamelFilePollerTest.java:59)
           [java] 	at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
           [java] 	at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:146)
           [java] 	at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:90)
           [java] 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
           [java] 	at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
           [java] 	at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
           [java] 	at org.apache.camel.component.file.FileConsumer.pollFile(FileConsumer.java:128)
           [java] 	at org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:77)
           [java] 	at org.apache.camel.component.file.FileConsumer.pollFileOrDirectory(FileConsumer.java:84)
           [java] 	at org.apache.camel.component.file.FileConsumer.poll(FileConsumer.java:57)
           [java] 	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:65)
           [java] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
           [java] 	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
           [java] 	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
           [java] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
           [java] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
           [java] 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
           [java] 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
           [java] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
           [java] 	at java.lang.Thread.run(Thread.java:637)
      	
      
      

            hzbarcea1 Hadrian Zbarcea (Inactive)
            davestanley Dave Stanley (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: