我尝试创建一个路径,可以使用csv文件访问http url并简单地打印它的内容。不幸的是,文件正在不断读取。
这是我的代码:
context.addRoutes(new RouteBuilder() {
public void configure() {
from("timer://start?delay=5000")
.to("http4://127.0.0.1:18080/data.csv")
.unmarshal().csv()
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
String list = exchange.getIn().getBody(String.class);
log.info(list);
//Here I would like to stop the route when file reading is finished
}
});
});
谢谢!