Table of Contents
This chapter describes the roles and functions of JEUS in an inbound communication from an EIS to an application. It mainly describes the interoperation between Work Managers, MDBs (Message Driven Bean), and resource adapters.
This section discusses the basic concept and configuration of the Work Manager.
In order to execute a task in the background or pass information to another application in WAS, a resource adapter creates a Java thread. For WAS, a Java thread that is created directly by a resource adapter is not preferred. The Work Manager is intended to manage the threads of the task that is passed from the resource adapter. The task is expressed as an instance implementing the javax.resource.spi.work.Work interface.
Work Manager provided by JEUS is based on the thread pool. Since a thread pool is only created when the resource adapter actually starts to use the Work Manager, a valid Work Manager instance is always automatically provided through the javax.resource.spi.BootstrapContext instance.
Configuration of JEUS Work Manager is similar to that of a thread pool. If nothing is specified, Work Manager is created with default values defined in the jeus-connector-dd.xsd schema.
For more information about Work Manager and Work, refer to "10. Work Management" in the JCA standard 1.7.
In the JDK thread pool, when the number of threads reaches the minimum value (called the core size in JDK), additional threads are accumulated into a queue. If the queue becomes full, the pool increases the number of threads to the maximum value.
JEUS thread pools work similarly to JDK thread pools (java.util.concurrent.ThreadPoolExecutor), but the condition for increasing threads is more relaxed for the JEUS thread pool than that for JDK. In JEUS thread pool, number of threads can be increased according to the amount of work. If a resource adapter uses the Work Manager frequently, <keep-alive-time> and <queue-size> settings, as well as the minimum and maximum values, should be properly adjusted .
Since the Work Manager uses the thread pools internally, its configuration is similar to that of the thread pool. The Work Manager can be configured using the <worker-pool> element in the jeus-connector-dd.xml file that is included in the resource adapter.
The following is an example of configuring the Work Manager.
Sub-elements of <worker-pool> are explained in the following table:
For information about how to include the jeus-connector-dd.xml file into the RAR file, refer to "Chapter 4. Resource Adapter".
According to the JCA standard, message driven beans (MDB) should be implemented for an inbound communication from a resource adapter to an application deployed to JEUS. It is also recommended to call other EJB components through MDB.
According to [Figure 1.2], MDB is the starting point in a flow from WAS to an application.
This section describes how to interoperate MDB with a resource adapter in JEUS.
For details about message inflow, refer to the section "13. Message Inflow" of the JCA standard 1.7 or related documents.
See the following example of MDB.
@MessageDriven( activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") , @ActivationConfigProperty(propertyName = "DestinationProperties", propertyValue = "imqDestinationName=Queue") , @ActivationConfigProperty(propertyName = "ProviderIntegrationMode", propertyValue = "jndi") , @ActivationConfigProperty(propertyName = "ConnectionFactoryJndiName", propertyValue = "XAConnectionFactory") , @ActivationConfigProperty(propertyName = "DestinationJndiName", propertyValue = "jms/QUEUE1") } ) public class TestMsgBean implements javax.jms.MessageListener { ... @TransactionAttribute(TransactionAttributeType.REQUIRED) public void onMessage(Message message) { ... } }
In EJB 3.0 and later, annotations, instead of the ejb-jar.xml file, can be used for configuration. For MDB, properties required by the resource adapter should be configured using the@ActivationConfigProperty annotation. For further information, refer to the manuals provided by the resource adapter.
To interoperate with MDB, a resource adapter should be configured using the <mdb-resource-adapter-name> setting of the jeus-ejb-dd.xml file.
Specifies the resource adapter that will be integrated. The name of the resource adapter varies depending on the resource adapter module, a stand-alone module or a module that is included in the EAR file.
Standalone module: Specify a name of the module.
Module included in the EAR file: EAR file name + '#' + name of the module
The previous example shows a resource adapter module included in the EAR file. The name of the file is 'app', and the name of the module is 'ra'.
A resource adapter should be deployed before MDB is deployed.