我在独立环境中使用 Spring3.1。
我已经配置了 DMLC(DefaultMessageListenerContainer) 来监听远程 jboss4 服务器上的远程主题。
在收到 200000 条消息后,我的情况很糟糕,我收到的消息率很高(可能会更少)
侦听器在没有错误/警告的情况下停止接收消息。
但另一方面,应用程序仍在运行。(还有什么我需要杀死 -9 进程和常规 ./stop 脚本无济于事)
我配置错了什么?
这是我的配置:
<bean id="TgwListenerDLMC"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="topicConnFactory" />
<property name="pubSubDomain" value="true" />
<property name="destinationResolver" ref="destinationResolver" />
<property name="concurrentConsumers" value="1" />
<property name="destinationName" value="/topic/TopicRealTime" />
<property name="messageListener" ref="TgwMDB" />
<property name="sessionAcknowledgeModeName" value="AUTO_ACKNOWLEDGE" />
<property name="recoveryInterval" value="5000" />
</bean>
<bean id="topicConnFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="jndiTopicConnFactory" />
<property name="reconnectOnException" value="true" />
<!-- Number of sessions that will be cached -->
<property name="sessionCacheSize" value="20" />
</bean>
<bean id="jndiTopicConnFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate" />
<!-- JNDI name of connection factory as defined by provider -->
<property name="jndiName" value="ConnectionFactory" />
</bean>
<bean id="destinationResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
<!--
do not create a dynamic destination if the destination name is not
found in JNDI
-->
<property name="fallbackToDynamicDestination" value="false" />
</bean>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.provider.url">${java.naming.provider.url}</prop>
<prop key="java.naming.factory.initial">${java.naming.factory.initial}</prop>
<prop key="java.naming.factory.url.pkgs">${java.naming.factory.url.pkgs}</prop>
</props>
</property>
</bean>
这是使用 jstack 打印的 ThreadDump:
[Loaded sun.reflect.GeneratedConstructorAccessor17 from __JVM_DefineClass__]
2012-08-29 14:45:37,771 org.springframework.jms.connection.CachingConnectionFactory [WARN] Encountered a JMSException - resetting the underlying JMS Connection
javax.jms.JMSException: Failure on underlying remoting connection
at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:102)
at org.jboss.remoting.ConnectionValidator$1.run(ConnectionValidator.java:608)
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor88 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor89 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor90 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor91 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor92 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor93 from __JVM_DefineClass__]
[Loaded sun.reflect.GeneratedSerializationConstructorAccessor94 from __JVM_DefineClass__]
谢谢,雷。