camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Using ConsumerTemplate to fetch files.
Date Wed, 15 Dec 2010 06:44:55 GMT
Its probably best to receive without any timeout, using receiveNoWait.


On Tue, Dec 14, 2010 at 6:43 PM, Andreas A. <andreasasmuss@gmail.com> wrote:
>
> Hi
>
> Something fishy is still going on, this is the code now:
>
> String ftpsUri =
> "ftp:localhost:1981/inbox?consumer.delay=1h&username=camel&password=camel123&move=.done";
> String fileUri = "file:{{path.in}}";
>
> consumer.start();
>
> while(true) {
>        Exchange exchange = consumer.receive(ftpsUri, 5000);
>
>        if(exchange == null) {
>                consumer.stop();
>                break;
>        }
>
>        if (exchange.getUnitOfWork() == null) {
>                // handover completions and done them manually to ensure they
are being
> executed
>                List<Synchronization> synchronizations = exchange.handoverCompletions();
>                this.doneSynchronizations(exchange, synchronizations);
>        } else {
>                exchange.getUnitOfWork().done(exchange);
>        }
>        logger.info("Fetching file: " +
> exchange.getIn().getHeader("CamelFileName"));
>        producer.send(fileUri, exchange);
> }
>
> -> ERROR Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot retrieve file: GenericFile[op06.txt] from:
> Endpoint[ftp://localhost:1981/inbox?consumer.delay=1h&move=.done&password=******&username=camel]]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> retrieve file: GenericFile[op06.txt] from:
> Endpoint[ftp://localhost:1981/inbox?consumer.delay=1h&move=.done&password=******&username=camel]
>        at
> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:308)
>        at
> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:155)
>        at
> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:121)
>
> ---
>
> -> ERROR Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot rename file: GenericFile[op01.txt] to: GenericFile[.done/op01.txt]]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> rename file: GenericFile[op01.txt] to: GenericFile[.done/op01.txt]
>        at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:100)
>
> ---
>
> -> ERROR Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException - File
> operation failed: 550 File not found
>  Cannot change directory to: inbox. Code: 550]
> org.apache.camel.component.file.GenericFileOperationFailedException: File
> operation failed: 550 File not found
>  Cannot change directory to: inbox. Code: 550
>        at
> org.apache.camel.component.file.remote.FtpOperations.doChangeDirectory(FtpOperations.java:611)
>        at
> org.apache.camel.component.file.remote.FtpOperations.changeCurrentDirectory(FtpOperations.java:587)
>        at
> org.apache.camel.component.file.remote.FtpOperations.retrieveFileToStreamInBody(FtpOperations.java:319)
>
> ---
>
> I believe I am this the same way as the DefaultConsumerTemplate is doing it.
> Could this have something to do with the stopping/starting of the consumer?
> Or is it still the "done"-ing that is not being performed correctly?
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-ConsumerTemplate-to-fetch-files-tp3304671p3304969.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message