我是spring-camel和apache camel的新手。
我读过http://camel.apache.org/file.html
我想要监听文件修改。
我这样写道:
@PostConstruct
public void init() {
from("file:feed.txt")
.log("msg: ${body}")
.process(exchange -> {
System.out.println(exchange.getIn().getBody());
});
}启动时会调用init方法,但不会调用进程回调。
我试图在启动后向文件中添加新的行,但没有任何反应。
此外,我确信应用程序会看到该文件,因为它会在启动时登录:
2017-10-24 15:26:13.421 INFO 10620 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: file://feed.txt我做错了什么?
发布于 2017-10-24 22:09:34
正确的链接:
http://people.apache.org/~dkulp/camel/file2.html
我创建了目录feed而不是文件feed.txt
并在那里放了几个文件。然后我启动了app,Camel读取了它,Camel将我的文件移到了.camel目录中。我也试着把文件放回原处。我将文件放到feed文件夹中,Camel成功读取了它。
https://stackoverflow.com/questions/46910691
复制相似问题