Search code examples
javaapache-camelcamel-ftp

Apache Camel: FTP batch consumer doesn't print file batch index and file batch size


I am developing a route to download files from a FTP location batch-wise. Please find below my route -

**from("ftp://user@ftphost/inbox?password=XXXX&binary=true&recursive=true")
            .log("Batch Index = ${header.CamelFileBatchIndex}, Batch Size = ${header.CamelFileBatchSize}")
            .to("file:outbox");**

The route works fine and all the files are downloaded. But the batch details (i.e. CamelFileBatchIndex and CamelFileBatchSize) are not getting logged.

Please find below the output -

**2016-06-28 18:56:24.600  INFO 8696 --- [           main] com.camel.examples.CamelApplication      : Started CamelApplication in 9.814 seconds (JVM running for 11.237)**

**2016-06-28 18:56:28.594  INFO 8696 --- [/inbox] route1                                   : Batch Index = , Batch Size =**

Solution

  • You are using the wrong names for those fields. You can find their constant values here: http://camel.apache.org/maven/current/camel-core/apidocs/constant-values.html#org.apache.camel.Exchange.BATCH_INDEX

    Its CamelBatchSize and CamelBatchIndex