ken*_*3th 8 spring activemq-classic apache-camel
如何在spring上下文中配置多个远程activemq代理(不同的IP地址)?以下是1个远程代理的配置.我使用camel创建路由,从多个远程代理中的不同队列生成和使用消息.根据以下路由,系统如何知道每个队列属于哪个远程代理?
项目清单
从( "直接:启动")来.( "ActiveMQ的:队列:outgoingRequests")
项目清单
from("activemq:queue:incomingOrders").to("log:Events?showAll = true").to("bean:jmsService")
1个代理org.camel.routes的Spring上下文
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://10.1.11.97:61616" />
</bean>
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory" init-
method="start" destroy-method="stop">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="10"/>
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
Pet*_*der 17
只需添加更多具有不同名称的组件
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
<bean id="activemq2" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="myOtherJmsConfig"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
然后只需使用名称:
<from uri="activemq:queue:MY.QUEUE"/><!-- get from "1st" ActiveMQ -->
<to uri="activemq2:queue:MY.QUEUE"/> <!-- put to same queue name on other ActiveMQ -->
Run Code Online (Sandbox Code Playgroud)
实际上,你可以随心所欲地打电话给他们,比如"EuropeanMarketBroker"或其他适合的东西.
| 归档时间: |
|
| 查看次数: |
6438 次 |
| 最近记录: |