我需要多少个Apache Camel队列?

时间:2011-12-06 20:59:28

标签: configuration apache-camel

我有一个包含15项服务的系统。我是骆驼和JMS远程的新手。有15个服务,我认为每个服务应该有一个传入队列。

但是,似乎队列只能绑定到一个接口:

org.apache.camel.example.server.Treble implements two interfaces     
org.apache.camel.example.server.Multiplier and org.apache.camel.example.server.Divider. I bind the two interfaces to the same JMS queue: jms:queue:numbers

<bean id="multiplier" class="org.apache.camel.spring.remoting.CamelServiceExporter">
          <property name="uri" value="jms:queue:numbers" />
          <property name="service">
                 <bean class="org.apache.camel.example.server.Treble" />
          </property>
          <property name="serviceInterface"  value="org.apache.camel.example.server.Multiplier" />
   </bean>
<bean id="divider" class="org.apache.camel.spring.remoting.CamelServiceExporter">
          <property name="uri" value="jms:queue:numbers" />
          <property name="service">
                 <bean class="org.apache.camel.example.server.Treble" />
          </property>
          <property name="serviceInterface" value="org.apache.camel.example.server.Divider" />
   </bean>

我发现只有第一个绑定(org.apache.camel.example.server.Multiplier)有效。在客户端,我获得了org.apache.camel.example.server.Divider的代理并调用了divide()。消息可以到达服务器端。但是当Camel尝试处理消息时,camel只缓存绑定到jms:queue:numbers的第一个接口的代理。因此它无法处理消息并抛出异常

这是否意味着如果我想使用jms与骆驼远程连接我需要2个队列(进/出)/类?那很贵吗?

1 个答案:

答案 0 :(得分:1)

如果您需要所有服务使用相同的传入端点,请使用路由器http://camel.apache.org/dynamic-router.html

相关问题