Amit Mishra
Amit Mishra

Reputation: 510

Camel SFTP is not listening to modified and Delete file events

I am trying to implement camel sftp so that I can listen for events in remote file directories. When there is an event I should download the file and move it to some other location

My Current Route Setup is :

String uri= sftp://test.remoteadd.cc/opt/tomcat/webapps/file-watch?noop=true&privateKeyFile=src/main/resources/keypair.pem&recursive=true&download=true&stepwise=false&useUserKnownHostsFile=false&username=ubuntu&binary=true&streamDownload=true

RouteBuilder rb = new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from(routeUriBuilder.toString())
                    .routeId(routeHandlerId)
                    .setHeader("fileName").simple("${file:name}")
                    .bean(RemoteFileWatcherEventProcessor.class, "process(${body}, ${headers})")
                    .to("file:/opt/test.cc/tomcat/webapps?fileName=${body.fileName}&autoCreate=true");
        }
    };

Now,I am facing some errors

I am not getting events for modified and deleted files. I get triggers only for created events.

Upvotes: 1

Views: 147

Answers (1)

Jeremy Ross
Jeremy Ross

Reputation: 11600

FTP doesn't expose any kind of event you're asking for. But Camel can detect changes to files on the server by using the idempotentKey option. E.g., idempotentKey=${file:name}-${file:modified}

(Recapped from Camel chat)

Upvotes: 1

Related Questions