I was doing just that, what I found that works is to create multiple routes that are in effect chained off one of another like the following works [meaning the files get properly deleted]:
context.addRoutes(new RouteBuilder { "file:perf?delete=true" ==> { process(myProcessor).to("file:perf_outbox") } "file:perf_outbox?delete=true" ==> { process(insertProcessor).to("file:perf_insert") } "file:perf_insert?delete=true" ==> { split(_.getIn().getBody(classOf[String]).split("\n")).to("jdbc:dataSource") } }) Where the initial processor loads everything and perform the initial split: val myProcessor = (exchange: Exchange) => { val lines = Source.fromFile(exchange.getIn().getBody(classOf[File])).getLines val body = new ArrayBuffer[String]() lines.foreach(line => { val lineSplit = line.split("\\[\\]\\: ") if (lineSplit.size >= 2) { val split = lineSplit(1).split(" ") if (split.length >= 11) body += split(0) + "," + split(1) + "," + split(2) + "," + split(3) + "," + split(4) + "," + split(5) + "," + split(7) + "," + split(10) else println("Secondary Split Not Enough Line Data") } else println("Initial Split Not Enough Line Data") }) exchange.getIn().setBody(body.mkString("\n")) } Then the secondary split takes that and turns it into SQL statements: val format = "INSERT INTO EVT_PERF ( EVT_PERF_ID, CRLTN_ID, USER_ID, APPN_SYS_CD, HOST_NM, WEBLOGIC_INSTNC_NM, WEB_ANLYTCS_CRLTN_ID, LOGGER_CLASS_NM, EXEC_TIME ) values ( EVT_PERF_ID_SEQ.NEXTVAL, ''{0}'', ''{1}'', ''{2}'', ''{3}'', ''{4}'', ''{5}'', ''{6}'', {7} )" val insertProcessor = (exchange: Exchange) => { val lines = Source.fromFile(exchange.getIn().getBody(classOf[File])).getLines val body = for { line <- lines val split = line.split(",") // Build the insert statement val x = MessageFormat.format(format, split(0), split(1), split(2), split(3), split(4), split(5), split(6), split(7)) // Replace the incoming message with the insert statement } yield x exchange.getIn().setBody(body.mkString("\n")) } The interesting thing to me is that the following route works as works as expected: "file:perf_insert?delete=true" ==> { split(_.getIn().getBody(classOf[String]).split("\n")).to("jdbc:dataSource") } Meaning, that the split properly splits up the input and sends it to the JDBC component, then deletes the file once it is done processing. -- View this message in context: http://camel.465427.n5.nabble.com/File-Processor-Not-deleting-the-files-tp5670301p5694084.html Sent from the Camel - Users mailing list archive at Nabble.com.