Camel - 在Spring中配置多个组件bean

时间:2014-12-17 22:27:58

标签: apache-camel

在Spring xml中,您可以按如下方式配置(比如说)JMS Endpoint:

<bean id="solaceJmsComponent" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="mySolaceConnectionFactory/>
</bean>

但是,如果我需要在同一台服务器上运行另一个完全不相关的JMS连接呢?我可以在配置中添加另一个组件bean,例如:

<bean id="anotherJmsComponent" class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="anotherConnectionFactory/>
</bean>

但是当我指定一个URL(比如jms:queue:foo)时,我不知道如何指定要使用的JmsComponent实例。

我该怎么做?

1 个答案:

答案 0 :(得分:3)

bean的id是Camel端点中使用的名称,例如use

solaceJmsComponent:queue:foo
anotherJmsComponent:queue:bar

jms只是默认名称。

相关问题