In the previous example we transformed data using Processor and update the exchange object. Transform()is a method in the Java DSL that can be used in Camel routes to trans-form messages. It is allowing the use of expressions. In this example we will create a Simple Router and implementing transform method to do the transformation.
Transform text file to csv file using Camel transform()
1. Create a Maven Project and add below dependencies
1. Create a Camel Route and start
To create Camel router we need to extends RouteBuilder class and implement configure() method, here we are defining two end points like source and destination folder. While running this router it will consume all the files from the source folder and transform method will replace all line separated symbol to comma and copying to destination folder.
2. Run the program
Run the program and place the input file in the source folder
3. Download example