以下是部署为基本框架的基本 groovy 路由类中的 3 条路由。
from("jms:queue:EndPoint1?concurrentConsumers=100")
.routePolicyRef("myPolicy")
.transacted()
.log("Recieved From Endpoint1")
/*.to("log:Recieved From Endpoint1?groupSize=100")*/
.to("CommonEndpoint");
from("jms:queue:EndPoint2?concurrentConsumers=50")
.rootPolicyRef("myPolicy")
/*.to("log:Recieved From Endpoint2?groupSize=100")*/
.log("Recieved From Endpoint2")
.to("CommonEndpoint");
from("CommonEndpoint")
.delay(50)
/*.to("log:Delayed?groupSize=100")*/
.log("Delayed");
下面是我在引用基本框架的包中创建的计时器路由。
from("timer://Timer1?fixedRate=true&period=60000")
.to("jms:queue:EndPoint1");
和
from("timer://Timer2?fixedRate=true&period=60000")
.to("jms:queue:EndPoint2");
它不断地向端点1 和端点2 发送定时器消息,它们都向公共端点发送消息。我的 ThrottlingInflightRoutePolicy 定义如下。
<bean id="myPolicy" class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
<property name="scope" value="Context"/>
<property name="maxInflightExchanges" value="20"/>
<property name="resumePercentOfMax" value="10"/>
<property name="loggingLevel" value="WARN"/>
</bean>
在检查日志时,我可以简单地看到计时器的日志跟踪。我不明白如何在检查日志时限制请求。我这里有什么遗漏吗?在我的代码中应该做什么来测试节流......?