Java 我们可以直接从seda:queue传递消息到camel中的direct:endpoint吗?
使用以下配置:Java 我们可以直接从seda:queue传递消息到camel中的direct:endpoint吗?,java,jakarta-ee,apache-camel,integration,Java,Jakarta Ee,Apache Camel,Integration,使用以下配置: <camel:camelContext> <camel:template id="camelProcessTemplate" /> <camel:endpoint id="asyncEndpoint" uri="seda:asyncQueue" /> <camel:endpoint id="calcWeightEndpoint" uri="direct:calculateWeightIn" /> <came
<camel:camelContext>
<camel:template id="camelProcessTemplate" />
<camel:endpoint id="asyncEndpoint" uri="seda:asyncQueue" />
<camel:endpoint id="calcWeightEndpoint" uri="direct:calculateWeightIn" />
<camel:route id="route1">
<camel:from ref="..." />
<camel:to ref="asyncEndpoint" />
</camel:route>
<camel:route id="route2">
<camel:from ref="asyncEndpoint" />
<camel:to ref="calcWeightEndpoint" />
</camel:route>
<camel:route id="route3">
<camel:from ref="calcWeightEndpoint" />
<camel:process ref="..." />
<camel:to ref="..." />
</camel:route>
</camel:camelContext>
消息正在进入route2,但没有传递到route3。您应该使用
uri
属性,而不是from
s和to
s中的ref
属性:
<camel:to uri="direct:calculateWeightIn" />
此外,route3中的处理器可能出现故障,并且没有正确记录。可以在来自的和过程之间添加
步骤
编辑1:OP更新了问题以更正其代码块
请在来自的和过程之间添加
,以验证消息是否到达路由3
?正如我上面所说,问题可能出在您的处理器上。感谢您的快速响应,更新了问题,我觉得这不是问题所在。通过id引用端点时不使用ref。如果使用uri,则需要使用ref:id语法,请参阅: