Quarkus camel-如何在 Camel 3 中模拟路由的返回值?

问题描述 投票:0回答:0

我正在尝试复制一些在 Camel 2 中工作的模拟/建议功能,但在 Camel 3 中找不到类似的路径。我的目标是用我提供的对象完全替换路由,最好不要运行原始路径路线。

路线:


from("direct:someRoute")
.id("someRoute")
.log(...)
.toD("http://some.call.com/request")
.id("someCall")
.log(...)
.end()

骆驼2:

RouteDefinition rd = this.camelContext.getRouteDefinition("someRoute");

rd.adviceWith(this.camelContext, new AdviceWithRouteBuilder(){
    @Override
    public void configure() throws Exception {
        weaveById("someCall")
            .replace()
            .setBody(constant("{}"));
    }
});
this.camelContext.start();

这在 camel2 中有效,但注意到无法从 3 中的上下文中获取

RouteDefinition
,并且在
adviceWith
对象上没有
Route

我也尝试过

AdviceWith.adviceWith(context, route, a->{})
,但是
a->{}
缺少像
constant
这样的RouteBuilder函数。

java testing apache-camel quarkus
© www.soinside.com 2019 - 2024. All rights reserved.