Flex客户端断开连接时,ActiveMQ不会停止订阅 [英] ActiveMQ does not stop subscription when flex client disconnects

查看:98
本文介绍了Flex客户端断开连接时,ActiveMQ不会停止订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用activeMQ 5.3通过炽烈的3.2向Flex客户端发送消息。

I'm using activeMQ 5.3 to send messages to a flex client via blazeds 3.2.

当客户端第一次连接时,我可以看到对activeMQ代理的订阅。但是,在终止运行客户端的浏览器之后,即使不再消耗任何消息,订阅仍保持打开状态。最终导致Web服务器的内存不足。从日志看,Bladeds似乎正在取消订阅源。

When the client connects for the first time, I can see the subscriptions to the activeMQ broker being made. However, after I kill the browser that runs the client the subscriptions remain open even though no messages are being consumed anymore. This finally results in an out-of-memory of the web server. From the logs it looks like Blazeds is unsubscribing from the feeds.

当没有客户端再连接并且他为什么不这样做时,不要大惊小怪地停止订阅吗?

Shouldn't blazeds stop the subscription when there are no clients that connect anymore and why isn't he doing that?

下面您可以从日志文件中找到一个摘要。

Below you can find a snippet from the log files.


...
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的配置

Below you can find the configuration used to for 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" />

最诚挚的问候
Jan

Best regards Jan

推荐答案

看起来像是在不关闭连接的情况下出现的问题

Does look like a blazeds problem of not closing down the connection

这篇关于Flex客户端断开连接时,ActiveMQ不会停止订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆