camel processor在循环

时间:2015-10-11 13:20:10

标签: java apache-camel

为什么以下代码不会再次向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);
                  }
              });               

        }

0 个答案:

没有答案