This chapter includes the following sections:
All instances of a message-driven bean are equivalent—the EJB container can assign a message to any MDB instance. The container can pool these instances to allow streams of messages to be processed concurrently.
The EJB container interacts directly with a message-driven bean—creating bean instances and passing JMS messages to those instances as necessary. The container creates bean instances at deployment time and may add and remove instances during operations based on message traffic.
MDBs and Concurrent Processing
max-beans-in-free-poolattribute, the number of available threads in the thread pool, the type of thread pool, and sometimes other factors determine the maximum number of MDB instances in a free pool .
For more information about topics and queues, see MDBs and Messaging Models.
The maximum number of MDB instances in a free pool depends on multiple factors. See Tuning Message-Driven Beans in Tuning Performance of Oracle WebLogic Server.
The number of free pools associated with an MDB deployment depends on the type of destination the MDB deployment is connected to. Typically, an MDB deployment is associated with a single free pool on each Oracle WebLogic Server instance that hosts the deployment. However, on each Oracle WebLogic Server instance that hosts the deployment, an MDB deployment connected to a WebLogic JMS distributed destination might have one free pool for each physical destination associated with the distributed destination. The number of free pools is automatically determined by the EJB container; and, for MDBs associated with a JMS destination, each MDB free pool always corresponds to a single JMS connection.
In a queue-based JMS application (point-to-point model), each MDB instance creates a single internal JMS session and corresponds to an MDB thread.
A topic-based JMS application (the publish/subscribe model) may require a single instance, may share a single JMS session between multiple instances, or may create a session for each instance. This is automatically determined by the MDB container based on the message processing pattern specified by MDB application settings, the type of topic, the work-manager, and the
max-beans-in-free-pool setting. See Configuring and Deploying MDBs Using JMS Topics. Also see Tuning Message-Driven Beans in Tuning Performance of Oracle WebLogic Server.
Limitations for Multi-threaded Topic MDBs
The default behavior for non-transactional topic MDBs is to multi-thread the message processing. There are some limitations when using:
Non-transactional topic MDBs that work with foreign (non-WebLogic) topics
Non-transactional topic MDBs that consume from a WebLogic JMS topic and process messages that have a WebLogic JMS Unit-of-Order (UOO) value
For details, see the Caution in Controlling MDB Concurrency.