【问题标题】:Wildfly 10 with JMS (ActiveMQ)Wildfly 10 与 JMS (ActiveMQ)
【发布时间】:2017-04-14 18:39:06
【问题描述】:

我成功配置了带有 ActiveMQ 作为流的 Wildfly 服务器

    <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
        <server name="default">
            <security enabled="false"/>
            <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
            <http-acceptor name="http-acceptor" http-listener="default"/>
            <jms-queue name="UpdateQueue" entries="java:/jms/UpdateQueue java:jboss/exported/jms/UpdateQueue"/>
            <connection-factory name="ConnectionFactory" entries="java:jboss/exported/jms/ConnectionFactory" connectors="http-connector"/>
        </server>
    </subsystem>

消息使用默认的本地 javax.jms 实现从队列成功发送/接收。

我使用以下配置访问 JMS 队列以发送/接收。

String EX_JNDI_FACTORY = "org.jboss.naming.remote.client.InitialContextFactory";
    String SERVER_URL = "http-remoting://127.0.0.1:8080";
    String JMS_FACTORY = "jms/ConnectionFactory";
    String QUEUE_NAME = "jms/UpdateQueue";

大多数时候消息在发送和接收之间花费了太长时间,有时在发送和接收消息之间花费了 3 分钟,我不知道这种行为的原因。有什么想法吗?

【问题讨论】:

标签: jms activemq wildfly


【解决方案1】:

我类接收多次但没有关闭接收器、会话和连接。我在 qreceiver.receive(0) 之后添加了以下代码,一切运行正常。

    try{
        if (qreceiver != null){
            qreceiver.close();
            qreceiver = null;
        }

        qsession.close();
        qcon.close();
    }catch (JMSException e) {
        e.printStackTrace();
    }

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2017-01-10
  • 2015-12-01
  • 2017-01-23
  • 2019-11-14
  • 2017-09-21
  • 1970-01-01
  • 1970-01-01
  • 2020-09-25
相关资源
最近更新 更多