2 MDB Life Cycle
This chapter includes the following sections:
Overview
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 initially populates each MDB free pool according to initial-beans-in-free-pool, which defaults to 0. It creates additional instances on demand and may remove instances during operation.
MDBs and Concurrent Processing
max-beans-in-free-pool setting, the Work Manager or execute-thread configuration, and the message-processing mode determine the maximum number of concurrent MDB invocations for each pool.For more information about topics and queues, see MDBs and Messaging Models.
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.
For queue-based MDBs, the container creates and manages the JMS sessions used to receive messages and obtains an available bean instance from the pool for each invocation.
Topic-based MDBs may process messages serially, dispatch messages received through one JMS session to multiple pooled bean instances, or use multiple JMS sessions for concurrent consumption. 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
Topic MDB concurrency depends on the JMS provider, transaction settings, topic distribution mode, and concurrency settings. 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 in
Compatibilitymode that consume from a WebLogic JMS topic and process messages with a WebLogic JMS Unit-of-Order (UOO) value
For details, see the Caution in Controlling MDB Concurrency.