我有一个ActiveMQ实例将传入的消息桥接到WebsphereMQ。如何控制ActiveMQ连接到WebsphereMQ所使用的连接数?
根据http://www-01.ibm.com/support/docview.wss?uid=swg21665128,似乎我必须编写自己的连接池,但那么默认行为是什么?
My Spring配置桥:
<bean id="wmqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="queueManager" value="queueManager"/>
<property name="connectionNameList" value="connectionNameList"/>
<property name="channel" value="channel"/>
<property name="transportType">
<util:constant static-field="com.ibm.msg.client.wmq.WMQConstants.WMQ_CM_CLIENT"/>
</property>
<property name="clientID" value="clientID"/>
</bean>
<bean id="cachedWmqConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory">
<ref local="wmqConnectionFactory" />
</property>
<property name="reconnectOnException" value="true" />
<property name="sessionCacheSize" value="1" />
</bean>
<bean id="wmqPatchedJmsConnector" class="org.apache.activemq.network.jms.JmsQueueConnector">
<property name="name" value="ActiveMq-WMQ-Bridge"/>
<property name="outboundQueueConnectionFactory" ref="cachedWmqConnectionFactory"/>
<property name="outboundQueueBridges">
<list>
<bean class="org.apache.activemq.network.jms.OutboundQueueBridge"><constructor-arg value="q1"/></bean>
</list>
</property>
<property name="inboundQueueBridges"><list/></property>
</bean>
<amq:broker useJmx="true" brokerName="${activemq.brokername:my-amq}" dataDirectory="${activemq.datadirectory}" persistent="true">
<amq:destinationPolicy>
<amq:policyMap>
<amq:policyEntries>
<amq:policyEntry queue=">" queuePrefetch="1">
<amq:deadLetterStrategy>
<amq:individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true" />
</amq:deadLetterStrategy>
</amq:policyEntry>
</amq:policyEntries>
</amq:policyMap>
</amq:destinationPolicy>
<amq:jmsBridgeConnectors>
<ref bean="jmsConnector"/>
</amq:jmsBridgeConnectors>
<amq:managementContext>
<amq:managementContext createConnector="false" />
</amq:managementContext>
<amq:transportConnectors>
<amq:transportConnector name="humble-transport"
uri="${local.host}" discoveryUri="${multicastGroup}"
updateClusterClients="true" rebalanceClusterClients="true"
updateClusterClientsOnRemove="true" />
</amq:transportConnectors>
</amq:broker>
谢谢!
答案 0 :(得分:1)
默认行为是每次进行JmsConnection时都会创建一个新的MQ Connection。正如您所说,您可以实现自己的层来重用连接,而不是定期关闭它们并创建新连接。
如果通过&#34;控制&#34;你的意思是,&#34;停止过多的&#34;您应该查看SVRCONN上的MAXINST和MAXINSTC参数。