我正在使用activeMQ 5.3通过blazeds 3.2向Flex客户端发送消息。
当客户端第一次连接时,我可以看到正在进行的activeMQ代理订阅。但是,在我终止运行客户端的浏览器之后,即使没有消息被消耗,订阅仍保持打开状态。这最终导致Web服务器的内存不足。从日志中看起来Blazeds取消了订阅源。
当没有客户连接时,不应该停止订阅,为什么他不这样做?
您可以在下面找到日志文件中的代码段。
... STARTING WEB SERVER ... 14 Dec 2009 15:54:59,015 [main] DEBUG activemq.transport.vm.VMTransportFactory - binding to broker: localhost 14 Dec 2009 15:54:59,031 [main] INFO apache.activemq.broker.TransportConnector - Connector vm://localhost Started 14 Dec 2009 15:54:59,031 [main] INFO apache.activemq.broker.BrokerService - ActiveMQ JMS Message Broker (localhost, ID:pcjbe-2026-1260802498843-0:0) started ... CONNECTING WITH CLIENT ... 14 Dec 2009 15:55:03,953 [VMTransport] DEBUG apache.activemq.broker.TransportConnection - Setting up new connection: vm://localhost#4 14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding consumer: ID:pcjbe-2026-1260802498843-2:2:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://ActiveMQ.Advisory.TempTopic 14 Dec 2009 15:55:03,968 [http-8000-3] INFO flex.messaging.jms.JmsAdapter - client [AEE95CCE-816B-EBCC-2ACE-41508E3338AC] subscribed to destination [detectorsFeed] 14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding consumer: ID:pcjbe-2026-1260802498843-2:2:1:1 for destination: topic://tmsng.topic.detectors 14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://tmsng.topic.detectors 14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://tmsng.topic.detectors 14 Dec 2009 15:55:03,968 [VMTransport] DEBUG activemq.broker.region.AbstractRegion - localhost adding destination: topic://ActiveMQ.Advisory.Consumer.Topic.tmsng.topic.detectors [BlazeDS]12/14/2009 15:55:03.968 [DEBUG] [Client.MessageClient] MessageClient created with clientId 'AEE95CCE-816B-EBCC-2ACE-41508E3338AC' for destination 'detectorsFeed'. ... DISCONNECTING CLIENT ... 14 Dec 2009 15:58:55,156 [http-8000-8] INFO flex.messaging.jms.JmsAdapter - client [AEF0AC64-7B6C-2749-8860-252B8A302EBA] unsubscribed from destination [detectorsFeed] [BlazeDS]12/14/2009 15:58:55.156 [DEBUG] [Client.MessageClient] MessageClient with clientId 'AEF0AC64-7B6C-2749-8860-252B8A302EBA' for destination 'detectorsFeed' has been invalidated.
您可以在下面找到用于ActiveMQ的配置
<beans xmlns="http://www.springframework.org/schema/beans" ...>
<amq:broker brokerName="localhost" useJmx="true" persistent="false" dataDirectory="${INSTALLDIR}/var" >
<amq:destinationPolicy>
<amq:policyMap>
<amq:policyEntries>
<amq:policyEntry topic=">" producerFlowControl="false">
<amq:pendingSubscriberPolicy>
<amq:vmCursor/>
</amq:pendingSubscriberPolicy>
</amq:policyEntry>
</amq:policyEntries>
</amq:policyMap>
</amq:destinationPolicy>
<amq:managementContext>
<amq:managementContext createConnector="false"/>
</amq:managementContext>
<amq:systemUsage>
<amq:systemUsage sendFailIfNoSpace="true">
<amq:memoryUsage>
<amq:memoryUsage limit="10mb" />
</amq:memoryUsage>
</amq:systemUsage>
</amq:systemUsage>
<amq:transportConnectors>
<amq:transportConnector uri="vm://localhost" />
</amq:transportConnectors>
</amq:broker>
<!-- JMS ConnectionFactory to use, configuring the embedded broker using XML -->
<amq:connectionFactory id="connectionFactory" brokerURL="vm://localhost" alwaysSessionAsync="true">
<amq:prefetchPolicy>
<!-- For pooled connections, set the prefetch to 1 to avoid out-of-order messages. (see http://activemq.apache.org/what-is-the-prefetch-limit-for.html) -->
<amq:prefetchPolicy all="1"/>
</amq:prefetchPolicy>
</amq:connectionFactory>
<!-- a pooling based JMS provider -->
<bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<amq:topic id="detectorTopic" physicalName="tmsng.topic.detectors" />
祝你好运 扬
答案 0 :(得分:0)
看起来像是没有关闭连接的blazeds问题