Hi
You should use the deadLetterChannel as the error handler.
errorHandler(deadLetterChannel("...")...
On Wed, Feb 13, 2013 at 2:06 PM, briane80 <[email protected]> wrote:
> Hi,
>
> I'm using camel 2.10.3 on windows 7.
>
> I have a route set up as follows:
>
> errorHandler("file:\\\\C:\\Errors").maximumRedeliveries(3).redeliveryDelay(5000).retryAttemptedLogLevel(LoggingLevel.WARN).useOriginalMessage());
>
> from("file:\\\\C:\\Messages\\Inbox?consumer.delay=5000&include=.*.gz").unmarshal().gzip().to("file:\\\\C:\\Messages\\Outbox")
>
> The include option ignores all files without a .gz extension.
>
> The issue im having is if a file comes in with a .gz extension but is not
> really a gzip file (i.e. a .txt file that i've manully rename the extension
> to .gz) then camel throws an exception as follows:
>
> [C:%5CMessages%5CTransportInbox] DeadLetterChannel WARN Failed
> delivery for (MessageId: ID-DT-013BG-005752-52292-1360760432044-0-1 on
> ExchangeId: ID-DT-013BG-005752-52292-1360760432044-0-2). On delivery
> attempt: 0 caught: java.io.IOException: Not in GZIP format
> [C:%5CMessages%5CTransportInbox] DeadLetterChannel WARN Failed
> delivery for (MessageId: ID-DT-013BG-005752-52292-1360760432044-0-1 on
> ExchangeId: ID-DT-013BG-005752-52292-1360760432044-0-2). On delivery
> attempt: 1 caught: java.io.IOException: Not in GZIP format
> [C:%5CMessages%5CTransportInbox] DeadLetterChannel WARN Failed
> delivery for (MessageId: ID-DT-013BG-005752-52292-1360760432044-0-1 on
> ExchangeId: ID-DT-013BG-005752-52292-1360760432044-0-2). On delivery
> attempt: 2 caught: java.io.IOException: Not in GZIP format
> [C:%5CMessages%5CTransportInbox] DeadLetterChannel WARN Failed
> delivery for (MessageId: ID-DT-013BG-005752-52292-1360760432044-0-1 on
> ExchangeId: ID-DT-013BG-005752-52292-1360760432044-0-2). On delivery
> attempt: 3 caught: java.io.IOException: Not in GZIP format
> [C:%5CMessages%5CTransportInbox] GenericFileOnCompletion WARN Caused
> by: [org.apache.camel.component.file.GenericFileOperationFailedException -
> Error renaming file from C:\Messages\TransportInbox\invalid_gzip_test9.gz to
> C:\Messages\TransportInbox\.camel\invalid_gzip_test9.gz]
> org.apache.camel.component.file.GenericFileOperationFailedException: Error
> renaming file from C:\Messages\TransportInbox\invalid_gzip_test9.gz to
> C:\Messages\TransportInbox\.camel\invalid_gzip_test9.gz
> at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
> at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
> at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
> at
> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
> at
> org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:226)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:199)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:37)
> at
> org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:157)
> at
> org.apache.camel.processor.RouteContextProcessor$1.done(RouteContextProcessor.java:56)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:106)
> at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
> at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
> at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:73)
> at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:336)
> at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:189)
> at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:155)
> at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:142)
> at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:92)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
> at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> Caused by: java.io.IOException: Renaming file from:
> C:\Messages\TransportInbox\invalid_gzip_test9.gz to:
> C:\Messages\TransportInbox\.camel\invalid_gzip_test9.gz failed due cannot
> delete from file: C:\Messages\TransportInbox\invalid_gzip_test9.gz after
> copy succeeded
> at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:384)
> at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
> ... 36 more
>
> An IOException is thrown as expected due to not in GZIP format.
>
> The file has been copied to the .camel directory and the deadletterchannel -
> however it still exists in the inbox folder camel still tried to process it
> over and over again due to:
>
> Caused by: java.io.IOException: Renaming file from:
> C:\Messages\TransportInbox\invalid_gzip_test9.gz to:
> C:\Messages\TransportInbox\.camel\invalid_gzip_test9.gz failed due cannot
> delete from file: C:\Messages\TransportInbox\invalid_gzip_test9.gz after
> copy succeeded
> at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:384)
> at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
> ... 36 more
>
> How do I stop camel trying to process the message?
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-handle-error-when-Renaming-file-from-failed-due-cannot-delete-from-file-tp5727493.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen