You need to configure handled(true) on your onException to tell Camel that the exception is okay and I am handling it. Then the FTP consumer will know this and regard it as success and perform a commit where it can delete the file.
On Tue, May 30, 2017 at 9:36 PM, GaryLeeMills <gary.l.mi...@ge.com> wrote: > Hello, > here is code snippet below: > what happens is my route has a bean that performs some verification on a > decoder for messages. if the decoder does not exist for the file ( pre > processing or conditioning the file ) the file is moved to localhost and > saved as the onException processing indicates. However, my problem is I need > to remove it from the FTP site also. When I connect and poll and pull the > file down, the exception is thrown the file is moved to the localhost fuse > server and placed in a directory for unhandled files. But, the file still > sits on the FTP site and my route is caught trying to pull this file down, > over and over. it is my endpoint parameter processor that throws the > exception I am concerned with - these are not FTP errors. > > is there a way to also move it from the FTP site. I use .move in the route > for normal good files, I'd like not to use delete. > > thank you!!! > > @Override > public void configure() throws Exception { > > if (validateConfiguration()) { > > // stepwise polich has changed on sftp server, > stepwise is default true > or enabled, must disable it > // "&eagerMaxMessagesPerPoll=false" > // + "&sortBy=file:modified" > // + "&fastExistsCheck=true" > // + "&move=.processed" + > final String fromStr = > String.format("%s://%s@%s:%s/%s?password=%s" > + "&move=.processed" > + "&maxMessagesPerPoll=50" > + "&eagerMaxMessagesPerPoll=false" > + "&sortBy=file:modified" > + "&passiveMode=true" > + "&sendEmptyMessageWhenIdle=false" > + "&stepwise=false" > , transport, username, > host, port, path, password); > > // Format the To Endpoint from Parameter(s). > final String toStr = String.format("%s", toEndpoint); > > onException(java.lang.Exception.class).to("file:" + > errorArchive); > > onException(com.ge.digital.fleet.inboundfile.exception.ParametersFileInvalidDataException.class).to(unhandledArchive); > > onException(com.ge.digital.fleet.inboundfile.exception.ParametersFileUnavailableException.class).to(unhandledArchive); > > from(fromStr).routeId(routeId).log(LoggingLevel.INFO, > "Message Received > from " + host) > .wireTap("file:" + fileArchive) > .split(body()).streaming() > // .split(body().tokenize("\n"), new > FleetAggregationStrategy()) > .process(new > EndpointParametersProcessor()) > // .end() > .to(toStr); > } else { > LOG.error("Unable to create route. Invalid > Configuration"); > } > } > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/FTP-route-throws-exception-move-file-but-not-move-on-SFTP-site-tp5801393.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2