Karim Ahmed
Karim Ahmed

Reputation: 103

Wildfly 10 with JMS (ActiveMQ)

I successfully configured the Wildfly server with ActiveMQ as flow

    <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>

The messages send/receive successfully from the queue using default native javax.jms implementation.

I use the following configuration to access the JMS Queue to send/receive.

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";

Most times the message took too long time between send and receive, sometimes its took 3 minutes between send and receive the message, I don't know the reason for this behavior. Any ideas?

Upvotes: 2

Views: 1852

Answers (1)

Karim Ahmed
Karim Ahmed

Reputation: 103

I class receive multiple time without close the receiver, session, and connection. I added the following code after qreceiver.receive(0) and everything run fine.

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

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

Upvotes: 1

Related Questions