kd0807
kd0807

Reputation: 660

Apache Camel does not retain file in source folder

While working on Apache Camel, whenever a file is zipped using camel-zip or copied via canel-ftp, Camel moves the file in .Camel folder and does not retain it in source folder after processing. I want my file to stay in the source folder after the processing has been done. Please advice how to achieve the same.

CamelContext context = new DefaultCamelContext(); context.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {

            from("file:src/main/zip?delete=false").marshal().zipFile()
                    .to("file:C:/Users/kdewan/Desktop");
        }

    });
    context.start();
    Thread.sleep(5000);
    context.stop();

Upvotes: 4

Views: 4155

Answers (2)

Panneerselvam
Panneerselvam

Reputation: 421

Please Check the "noop" property in Camel-File component.
By default it is "false" so it will move the processed folder in to .camel .
If you dont want to move it in .camel folder make it "noop" property "true".

Upvotes: 4

lahu89
lahu89

Reputation: 363

Camel moves files into the .Camel directory to avoid multiple processing of the same file. Ftp component inherits all options from file component, therefore it is possible to set a different location as archive directory:

ftp:...&move=directory/archive&moveFailed=directory/error

move: is the archive directory where the processed files should be stored

moveFailed: is the directory when an error occurred during processing

I believe the same logic can be used for camel-zip too.

When I use file component, I create this structure on my file system for better monitoring:

-- basic/Directory
---- /working
---- /archive
---- /error

Upvotes: 5

Related Questions