2

I'm trying to setup client side thread management on a Wildlfy 10 AS for JMS using ActiveMQ, I have a queue setup in standalone-full.xml DemoQueue currently the AS is creating endless threads eating up memory till eventual it crashes

 <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
        <server name="default">
            <security-setting name="#">
                <role name="guest" delete-non-durable-queue="true" create-non-durable-queue="true" consume="true" send="true"/>
            </security-setting>
            <address-setting name="#" message-counter-history-day-limit="10" page-size-bytes="2097152" max-size-bytes="10485760" expiry-address="jms.queue.ExpiryQueue" dead-letter-address="jms.queue.DLQ"/>
            <http-connector name="http-connector" endpoint="http-acceptor" socket-binding="http"/>
            <http-connector name="http-connector-throughput" endpoint="http-acceptor-throughput" socket-binding="http">
                <param name="batch-delay" value="50"/>
            </http-connector>
            <in-vm-connector name="in-vm" server-id="0"/>
            <http-acceptor name="http-acceptor" http-listener="default"/>
            <http-acceptor name="http-acceptor-throughput" http-listener="default">
                <param name="batch-delay" value="50"/>
                <param name="direct-deliver" value="false"/>
            </http-acceptor>
            <in-vm-acceptor name="in-vm" server-id="0"/>
            <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
            <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
            <jms-queue name="demoQueue" entries="java:/jms/queue/demoQueue java:jboss/exported/jms/queue/demoQueue"/>
            <connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
            <connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector"/>
            <pooled-connection-factory name="activemq-ra" transaction="xa" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm"/>
        </server>
    </subsystem>

I have it working with server side thread management. I'v been trying to follow the instructions found here so currently I'm using :

DEFAULT_CONNECTION_FACTORY=jms/RemoteConnectionFactory
DEFAULT_DESTINATION=java:/jms/queue/demoQueue
DEFAULT_USERNAME=mUserName
DEFAULT_PASSWORD=myPassword
INITIAL_CONTEXT_FACTORY=org.jboss.naming.remote.client.InitialContextFactory
PROVIDER_URL=http-remoting://myURL.com:8082

/** Lookup the queue object */
Queue queue = (Queue) context.lookup(props.getProperty("DEFAULT_DESTINATION"));

/** Lookup the queue connection factory */
ConnectionFactory connFactory = (ConnectionFactory) context.lookup(props.getProperty("DEFAULT_CONNECTION_FACTORY"));

try (javax.jms.Connection connection = connFactory.createConnection(props.getProperty("DEFAULT_USERNAME"), props.getProperty("DEFAULT_PASSWORD"));

   /** Create a queue session */
   Session queueSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

   /** Create a queue consumer */
   MessageConsumer msgConsumer = queueSession.createConsumer(queue)) {

   /** Set an asynchronous message listener */
   msgConsumer.setMessageListener(asyncReceiver);

   /** Set an asynchronous exception listener on the connection */
   connection.setExceptionListener(asyncReceiver);

   /** Start connection */
   connection.start();
}

Do I need to add the ClientSessionFactory configuration to my "standalone-full.xml" for client side thread management? I can't access the .setUseGlobalPools(falase); from the RemoteConnectionFactory.

I've tried adding:

ConnectionFactory myConnectionFactory = ActiveMQJMSClient.createConnectionFactory(myFactory);

I can't seem to access the needed methods from my code.

.useGlobalPools=false

scheduledThreadPoolMaxSize=10

I was using Wildfly 9 which implemented HornetQ so some of my configuration may need changing to work properly with ActiveMQ

JTK
  • 1,469
  • 2
  • 22
  • 39

1 Answers1

0

I was showin a solution to this by a helpful user over on the Jboss forums I used server side thread management by modifying my XML configuration

<connection-factory name="RemoteConnectionFactory"
 entries="java:jboss/exported/jms/RemoteConnectionFactory"
 connectors="http-connector" use-global-pools="false"
 thread-pool-max-size="10"/>

Another Stack user has pointed out on another question I had, that there may be an issue with this and other Wildfly version where this setting will not solve the problem, it did solve it for me, but there is another work around, by passing in the setting as a param during launch:

sh standalone.sh -c standalone-full.xml -Dactivemq.artemis.client.global.thread.pool.max.size=30
JTK
  • 1,469
  • 2
  • 22
  • 39