简体   繁体   English

在Apache Camel中使用动态路由器与DSL选择有什么影响?

[英]What are the implications of using a Dynamic Router versus a DSL choice in Apache Camel?

It appears that a Dynamic Router can be used in much the same way as choice in a route. 似乎动态路由器的使用方式与路径中的选择方式大致相同。 Furthermore, in the Java DSL choice() can be rather dynamic based on changing headers or properties in routes. 此外,在Java DSL中, choice()可以基于更改路由中的标头或属性而相当动态。

Are there guidelines for when either one should be used? 何时应该使用哪一个? Likewise, are there performance implications in using one over the other? 同样,使用一个是否会影响性能?

in short... 简而言之...

  • the choice is used to perform conditional logic from within a route choice用于从路径中执行条件逻辑
  • the dynamic router is used to route messages to other routes/endpoints dynamically dynamic router用于dynamic router将消息路由到其他路由/端点

that said, you can use the choice EIP to route to different endpoints based on content, but that endpoint list would be statically defined in the route. 也就是说,您可以使用选择EIP根据内容路由到不同的端点,但该端点列表将在路由中静态定义。 If you need to determine the routing endpoints at runtime, use dynamic router or recipient list 如果需要在运行时确定路由端点,请使用dynamic router收件人列表

performance characteristics should be similar, but are mostly determined by the Expression used to perform your content based routing (headers faster, xpath slower, etc) 性能特征应该类似,但主要取决于用于执行基于内容的路由的表达式(标题更快,xpath更慢等)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM