Search code examples
jakarta-eewebsphereejb-3.0ibm-mqmessage-driven-bean

EJB 3.0 MDB on Websphere, how to configure the thread pool


I am using an EJB 3.0 MDB to read messages asynchronously from a MQ queue. This MDB is packaged as a jar and imported as a dependency into a Web project.

This application is deployed on Websphere 8.x, and the whole configuration, including the activation spec is similar to the one showed in this post: How to configure Java Message Driven Beans and Websphere Activation specification without hardcoded JNDI Names?

My question is, how can I configure the thread pool, that is, the number of threads that are going to process the messages?

I have found some IBM articles about it, but all of them about the deprecated ListenerPorts, not the activation specs.


Solution

  • There are two basic settings to configure to control the number of messages that can be processed concurrently.

    First, the Maximum server sessions defines the number of concurrent messages that can be processed for each Activation specification.

    Second, the Activation specification server sessions are run on threads of the WMQJCAResourceAdapter thread pool, so this thread pool's Maximum size is important.

    So a good starting point is to configure the WMQJCAResourceAdapter thread pool such that it equals the sum of the Maximum server sessions settings across all WMQ Activation specifications visible to a server.

    E.g. if you have three WMQ Activation specifications in a server each with Maximum server sessions set to 25, you should set the WMQJCAResourceAdapter thread pool Maximum size to 75.

    This is all explained along with screenshots in this article.