1

我正在开发一个使用 Spring JMS (v3.1.0) 来使用来自主题 (IBM WebSphere MQ v7) 的一些消息的应用程序,并且对 MQ 的监控表明,在每次调用侦听器时,我们都会刷新/重新注册持久订阅。这会导致 MQ 出现意外过载。值得一提的是,该应用程序正在 IBM WepSphere v7 上运行。

这是我们的配置:

<bean id="myMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="destinationResolver" ref="jmsDestResolver"/>
    <property name="destination" ref="myTopic"/>
    <property name="connectionFactory" ref="myTopicConnectionFactory"/>
    <property name="messageListener" ref="myMessageListener" />
    <property name="pubSubDomain" value="true" />
    <property name="subscriptionDurable" value="true"/>
    <property name="durableSubscriptionName" value="${durableSubscriptionName}"/>
    <property name="sessionTransacted" value="true"/>
    <property name="transactionManager" ref="transactionManager" />
    <property name="taskExecutor" ref="taskExecutor" />

    <!-- Only CACHE_CONSUMER will lead to a fixed registration:
    http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#isRegisteredWithDestination%28%29
    -->
    <property name="cacheLevelName" value="CACHE_CONSUMER" />

    <!-- clientId already specified on the Topic Connection Factory -->
</bean>

<!-- Lookup the topic -->
<jee:jndi-lookup id="myTopic" jndi-name="${myTopic.jndiName}" />

<!-- Lookup the topic connection factory -->
<jee:jndi-lookup id="myTopicConnectionFactory" jndi-name="${myTopicConnectionFactory.jndiName}" />

<!-- Implements javax.jms.MessageListener -->
<bean id="myMessageListener" class="com.sample.jms.MyMessageListener" />

<!-- Get WebSphere work manager --> 
<bean id="taskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
   <property name="workManagerName" value="${taskManager.jndiName}" />
</bean>

<!-- 
    Lookup WebSpere transaction manager. More info see: 
    http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html#transaction-application-server-integration-websphere 
 -->
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

编辑:这些是我们正在使用的属性:

durableSubscriptionName=myMessageListenerContainer
myTopic.jndiName=jms/myTopic
myTopicConnectionFactory.jndiName=jms/myTopicConnectionFactory
taskManager.jndiName=wm/default

任何想法如何解决这个问题?谢谢!安德烈

4

1 回答 1

0

在我自己对 Websphere + Spring 的研究中,我遇到了这个问题。也许它会帮助你:

https://stackoverflow.com/a/795767/945150

基本上 Spring 是在不使用池的情况下创建大量连接

于 2012-10-23T23:17:44.437 回答