java - 如何在 Apache Camel 测试中模拟多播内部的路由
问题描述
如何在 Apache Camel 测试中模拟多播内部的路由
在 Cameltest 中模拟多播中的路由时出现错误,我可能错过了一些东西或者我错误地这样做了
请看下面的代码片段:
// RouteBuilder class
from(direct("get-data-id"))
.routeId("direct:get-data-id")
.setProperty("id", simple("${headers.id}"))
.multicast(new ImplAggregationStrategy()).parallelProcessing()
.to(direct("get-data-service-route"))
.end()
.setBody(DatasonnetExpression.builder("payload", String.class)
.bodyMediaType(MediaTypes.APPLICATION_JAVA)
.outputMediaType(MediaTypes.APPLICATION_JSON))
;
// Camel Test
routeToTest = "direct:get-data-id";
RouteDefinition routeDefinition = context.getRouteDefinition(routeToTest);
AdviceWith.adviceWith(routeDefinition, context, new AdviceWithRouteBuilder() {
@Override
public void configure() throws Exception {
weaveByToString(".*get-data-service-route.*")
.replace()
.setBody(datasonnet("resource:classpath:/data/get-persons-personId-response.json", LinkedCaseInsensitiveMap.class));
weaveAddLast().to("mock:result");
}
});
错误日志:
java.lang.IllegalArgumentException: There are no outputs which matches: .*get-data-service-route.* in the route: Route(direct:get-data-id)[From[direct://get-data-id] -> [OnException[[com.ms3_inc.camel.extensions.rest.exception.RestException] -> [process[Processor@0x18ac53e8], SetBody[com.datasonnet.document.DefaultDocument@c3177d5],
.
.
.
解决方案
推荐阅读
- javascript - Angular rxjs:延迟订阅直到其他 Observable 发出
- python - 用于反向排序日期的 Ironpython 脚本 + 必须从 Spotfire 7.8 中的列(过滤器类型:列表框)中选择最新日期?
- java - 如何通过 DataOutputStream 发送算术运算的有效结果
- c++ - 如何在 wxSmith 中定义新的框架类型?
- python - 一次用多个标记标记 test_
- ios - 如何使用 EXPO iOS StoreReview API?
- javascript - JavaScript 日期格式忽略时区
- r - 如何合并数据框中的行并合并单元格中的因子值
- rxjs - Rxjs 可观察,内部订阅需要很长时间,外部可观察在后续请求中首先执行
- python-3.x - 如何将数据帧的索引存储为新字符串?