【问题标题】:Camel - Configuring multiple component beans in SpringCamel - 在 Spring 中配置多个组件 bean
【发布时间】:2014-12-17 22:27:57
【问题描述】:

在 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 实例。

我该怎么做?

【问题讨论】:

    标签: apache-camel


    【解决方案1】:

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

    solaceJmsComponent:queue:foo
    anotherJmsComponent:queue:bar
    

    jms 只是默认名称。

    【讨论】:

    • 克劳斯!你是最好的。您如何找到时间编写代码和回答 SO 问题超出了我的范围。
    最近更新 更多