为什么以下代码不会再次向direct:stage
发送消息?
processing file
只获得一次打印... 为什么?
编辑:更新了代码。
final ProducerTemplate template = context.createProducerTemplate();
context.addRoutes(new RouteBuilder() {
public void configure() {
from("direct:stage").marshal().json(JsonLibrary.Gson)
.to("file://stage");
from("file://stage").unmarshal().json(JsonLibrary.Gson, MyTest.class)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
MyTest body = exchange.getIn().getBody(MyTest.class);
System.out.println("processing file");
template.send("direct:stage", exchange);
}
});
}