0

骆驼测试,直接用 seda 代替。

例如,在我的骆驼路线测试中,我想用直接替换 seda 呼叫

而不是“seda:Second_route_id”我的消费者应该是“直接:Second_route_id”进行测试

以下是我原来的路线

from("direct:First_route_id").id("First_route_id")
.process() // bla bla
.multicast()
.to("Second_route_id");

---
from("seda:Second_route_id").id("Second_route_id")
.proces() // save data
.end()

我试着做一些事情,比如

    context.getRouteDefination("First_route_id").adviceWith(context, new AdviceWithoutRouteBuilder(){
    public void configure(){
// but it gave me error no consumer found for "direct: Second_route_id"
    weaveById("Second_route_id").before().to("direct: Second_route_id "); 
    }
    })
4

2 回答 2

0

replaceFromWith在使用通知时,您可以使用一种方法将 seda 更改为直接。

于 2019-07-31T03:14:12.383 回答
0

replaceFromWith是一种可能的方式:

    camelContext.getRouteDefinition("Second_route_id").adviceWith(camelContext, new AdviceWithRouteBuilder() {

        @Override
        public void configure() throws Exception {
            replaceFromWith("direct:Second_route_id");
        }
    });
于 2019-08-05T08:12:44.160 回答