[英]Straight Through Processing in Apache Camel
我有兴趣找出在Apache Camel中直接处理的最佳方法。
我有几个不同的组件,我可以在同一个JVM中启动,它与我的activemq代理分开。 是否有意义尝试设置它以便我的消息从一个组件传递到下一个组件,按顺序阻塞? 我将如何设置camel以确保每条消息在下一条消息启动之前到达路径中的每个组件?
更具体一点:我想通过我的brokerURI配置来做到这一点。 我看到了这个页面: http : //fusesource.com/wiki/display/ProdInfo/Understanding+the+Threads+Allocated+in+ActiveMQ但我不确定在哪里/如何实现选项 - optimizedDispatch似乎对代理有效destinationPolicy选项。
谢谢
首先,明确配置路由中使用队列的单个消费者...
要么全局连接所有连接
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="1"/>
<property name="maxConcurrentConsumers" value="1"/>
</bean>
或明确按路线/消费者
from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConcumers=1")...
那么,你有几个选择。 通常,您要么使用管道模式在单个路由中的步骤(同步)之间传递消息。 或者使用camel-direct在多个路由之间提供同步消息流。
from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConcumers=1")
.to(<step1>)
.to(<step2>)
...
或者如果您的步骤需要多条路线,请使用直接连接它们...
from("activemq:queue:input?concurrentConsumers=1&maxConcurrentConsumers=1")
.to("direct:step1");
from("direct:step1")
//perform step1 processing
.to(direct:step2");
from("direct:step2")
//perform step2 processing
.to(direct:step3");
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.