基于Camel内容的路由器具有很多条件

时间:2013-11-22 10:54:27

标签: apache-camel messaging integration-patterns

我在标题中有一个具有特定值(例如100,101)的消息,我需要根据该值采取特定操作。

我知道我可以用基于内容的路由的when / otherwise分支编写路由。 我的问题是:如果我有大约400个不同的案例怎么办?在这些情况下是否有最佳实践来管理路由?

2 个答案:

答案 0 :(得分:1)

是使用收件人列表而不是可以动态计算端点 - 例如它的动态到。有关详细信息,请参阅此常见问题解答链接:http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

答案 1 :(得分:1)

另一种选择是使用ProducerTemplate从POJO类向任何端点发送消息,只需要注入/传入CamelContext的句柄等。