amq容器上存在的队列如何使用骆驼蓝图dsl从不同amq容器上存在的主题中读取消息?

时间:2018-10-26 15:58:56

标签: apache-camel middleware jbossfuse blueprint-osgi amq

我是骆驼蓝图DSL的新手。我想从同一服务器上单独的amq容器中存在的队列中读取已发布到AMQ容器中存在的主题的消息。

我很困惑如何从一个amq容器主题连接到另一个amq容器队列。 我是否需要为两个单独的amq容器创建两个JmsXAConnectionFactories?

我的蓝图看起来像这样-

http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd        http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd“>

<camelContext xmlns="http://camel.apache.org/schema/blueprint"
    xmlns:order="http://fusesource.com/examples/order/v7" id="cluster_blueprint">

        <!-- JMS connection for the external AMQ -->
    <bean id="jmsXAConnectionFactoryExternal" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="discovery:(fabric:masterslave)" />
        <property name="userName" value="admin" />
        <property name="password" value="admin" />
    </bean>
    <!-- JMS connection details for the internal AMQ -->
    <bean id="jmsXAConnectionFactoryInternal" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="discovery:(fabric:cluster)" /> <!-- Here, cluster is the group name where the internal amq is present -->
        <property name="userName" value="admin" />
        <property name="password" value="admin" />
    </bean>

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

    <bean id="activemqInternal" class="org.apache.camel.component.jms.JmsComponent">
        <property name="connectionFactory" ref="jmsXAConnectionFactoryInternal" />
    </bean>
    <route id="topic-to-queue-route">
        <from uri="activemqExternal:topic:bmg.cluster?clientId=clientrm&amp;durableSubscriptionName=subrm" />
        <log message="Received message from topic - bmg.cluster" loggingLevel="INFO" />
        <to uri="activemqInternal:queue:bmg.publish.capture" />
    </route>

</camelContext>

0 个答案:

没有答案