了解JBoss EAP 6.4(HornetQ)中的远程JMS连接

时间:2019-06-16 13:37:50

标签: java jms hornetq jboss-eap-6

我们的环境中存在太多的TCP连接问题,因此我们尝试限制尽可能多的连接。因此,我已将所有远程MDB的激活配置属性maxSession设置为1

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "user", propertyValue = "jmsuser"),
        @ActivationConfigProperty(propertyName = "password", propertyValue = "xxxx"),
        @ActivationConfigProperty(propertyName = "minSession", propertyValue = "1"),
        @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "myQueue"),
        @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=127.0.0.1;port=5545"),
        @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory") }, 
mappedName = "myQueue")
public class ReadQueueTest implements MessageListener {

    @Override
    public void onMessage(Message msg) {
        //do something...   
    }
}

在一个MDB中启动应用程序后,我获得以下TCP连接:

######:~ user$ netstat -an | grep 5545 | grep ESTA
tcp4       0      0  127.0.0.1.5545         127.0.0.1.64644        ESTABLISHED
tcp4       0      0  127.0.0.1.64644        127.0.0.1.5545         ESTABLISHED
tcp4       0      0  127.0.0.1.5545         127.0.0.1.64643        ESTABLISHED
tcp4       0      0  127.0.0.1.64643        127.0.0.1.5545         ESTABLISHED

几分钟后,连接计数增加:

######:~ user$ netstat -an | grep 5545 | grep ESTA
tcp4       0      0  127.0.0.1.5545         127.0.0.1.64652        ESTABLISHED
tcp4       0      0  127.0.0.1.64652        127.0.0.1.5545         ESTABLISHED
tcp4       0      0  127.0.0.1.5545         127.0.0.1.64644        ESTABLISHED
tcp4       0      0  127.0.0.1.64644        127.0.0.1.5545         ESTABLISHED
tcp4       0      0  127.0.0.1.5545         127.0.0.1.64643        ESTABLISHED
tcp4       0      0  127.0.0.1.64643        127.0.0.1.5545         ESTABLISHED

有人可以告诉我为什么会有这么多的联系,为什么会增加?是否可以将每个远程MDB的TCP连接限制为一个?

我们在HornetQ中使用JBoss EAP 6.4。

0 个答案:

没有答案