骆驼重定向到限制另一条路线(Camel Redirecting to another route on throttling)

编程入门 行业动态 更新时间:2024-10-24 06:35:48
骆驼重定向到限制另一条路线(Camel Redirecting to another route on throttling)

我有一个骆驼路线,在接收大量信息时会受到限制。 假设我定义的最大交换是每2秒3个,并且路由收到的超过我想要将这些消息重定向到其他负载均衡器路由的限制。 有人可以帮助我如何实现它?

I have a camel route which will be throttled on recieving loads of messages. Suppose the maximum exchanges i defined is 3 per 2 seconds and the route recieves more than the limit i want to redirect those messages to some other load balancer route. Can someone help me how to achieve it??

最满意答案

如果我正确理解您的问题,您希望限制收到的消息,然后将这些消息权衡到不同的路由或系统。

from("SomethingSendingMeMessages") .throttle(3) .loadbalance().roundRobin() .to("place1", "place2", "place3") .end();

如果您需要将限制路由发送到包含负载均衡器的第二个路由,您可以执行以下操作:

from("SomethingSendingMeMessages") .throttle(3) .to("direct:mySecondRoute"); from("direct:mySecondRoute") .loadbalance().roundRobin() .to("place1", "place2", "place3") .end();

您可以探索的另一个选项是在负载均衡器之后限制以控制每个单独路由的方法。

from("SomethingSendingMeMessages") .loadbalance().roundRobin() .to("direct:place1", "direct:place2") .end(); from("direct:place1") .throttle(3) .to("myOtherWork"); from("direct:place2") .throttle(3) .to("myOtherWork");

If I am understanding your question right you want to throttle your incoming messages then loadbalance those messages out to a different route or system.

from("SomethingSendingMeMessages") .throttle(3) .loadbalance().roundRobin() .to("place1", "place2", "place3") .end();

If you need to have the throttling route send to a second route that contains the loadbalancer you can do it like follows:

from("SomethingSendingMeMessages") .throttle(3) .to("direct:mySecondRoute"); from("direct:mySecondRoute") .loadbalance().roundRobin() .to("place1", "place2", "place3") .end();

Another option you could explore is throttling after the loadbalancer to control each individual route's method.

from("SomethingSendingMeMessages") .loadbalance().roundRobin() .to("direct:place1", "direct:place2") .end(); from("direct:place1") .throttle(3) .to("myOtherWork"); from("direct:place2") .throttle(3) .to("myOtherWork");

更多推荐

route,限制,messages,电脑培训,计算机培训,IT培训"/> <meta name="description

本文发布于:2023-07-26 15:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1277427.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骆驼   重定向   路线   Camel   route

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!