骆驼重定向到节流的另一条路线

Camel Redirecting to another route on throttling

我有一条骆驼路线,在接收大量消息时会受到限制。假设我定义的最大交换是每 2 秒 3 次,并且路由收到的消息超过了我想将这些消息重定向到其他负载均衡器路由的限制。谁能帮我实现一下??

如果我理解你的问题是正确的,你想限制你的传入消息,然后将这些消息负载平衡到不同的路由或系统。

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");