Java DSL Example

Talend ESB Mediation Developer Guide

EnrichVersion
6.2
EnrichProdName
Talend ESB
task
Installation and Upgrade
Design and Development
EnrichPlatform
Talend ESB

In the route below it will read the file content and tokenize by line breaks so each line can be sorted.

from("file://inbox").sort(body().tokenize("\n")).to(
   "bean:MyServiceBean.processLine");

You can pass in your own comparator as a second argument:

from("file://inbox").sort(body().tokenize("\n"), 
   new MyReverseComparator()).to("bean:MyServiceBean.processLine");