gpt4 book ai didi

apache-camel - 没有 "to"端点的 Apache Camel 路由

转载 作者:行者123 更新时间:2023-12-04 04:18:01 25 4
gpt4 key购买 nike

我正在使用 Apache Camel 来协助捕获第三方软件包发出的消息数据。在这个特定的例子中,我只需要捕捉软件产生的东西,另一端没有接收器(真的没有“端”去)。

因此,我尝试设置一条只有“from”端点而没有“to”端点的路由。显然这是不正确的用法,因为我收到以下异常:

[2018-08-15 11:08:03.205] ERROR: string.Launcher:191 - Exception
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> From[mina:udp://localhost:9877?sync=false] <<< in route: Route(route1)[[From[mina:udp://localhost:9877?sync=false]] -... because of Route route1 has no output processors. You need to add outputs to the route such as to("log:foo").
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1063)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2819)
at {removed}.Launcher.startCamel(Launcher.java:189)
at {removed}.Launcher.main(Launcher.java:125)
Caused by: java.lang.IllegalArgumentException: Route route1 has no output processors. You need to add outputs to the route such as to("log:foo").
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1061)
... 13 more

如何设置允许我拦截(捕获)来自源的消息流量,而不是将其“发送到”任何东西的 Camel 路由?不需要接收器。什么是合适的“to”端点,只是丢弃它接收到的所有内容?
to("log:foo")的异常(exception)建议.这有什么作用?

最佳答案

您可以查看 Stub组件可以提供帮助

http://camel.apache.org/stub.html

例子:

from("...")
.to("stub:nowhere");

关于apache-camel - 没有 "to"端点的 Apache Camel 路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51861611/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com