Last active
April 21, 2021 08:24
-
-
Save kunupat/77d534be7b149221a8bff792d47e91d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.camel.builder.RouteBuilder; | |
import org.springframework.stereotype.Component; | |
@Component | |
public class FileSplitterRoute extends RouteBuilder { | |
@Override | |
public void configure() throws Exception { | |
System.out.println("Configuring camel routes..."); | |
String inputFilePath = System.getProperty("user.home") + "/data/input/" ; | |
String outputFilePath = System.getProperty("user.home") + "/data/out/" ; | |
from("direct:start") | |
.noAutoStartup() | |
.pollEnrich("file://" + inputFilePath + "?noop=true&fileName=customers.csv") | |
.split().tokenize("\n",100) | |
.to("file://" + outputFilePath + "?fileName=customers_"+ "${header.CamelSplitIndex}" + ".csv") | |
.routeId("fileSplitterRoute") | |
.end(); | |
System.out.println("Configured camel routes..."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment