Chapter 3. Inbound Management

Table of Contents

3.1. Work Manager Management
3.1.1. Basic Concept
3.1.2. Work Manager Configuration
3.2. Message Inflow

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.

3.1. Work Manager Management

This section discusses the basic concept and configuration of the Work Manager.

3.1.1. Basic Concept

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.

Note

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 .

3.1.2. Work Manager Configuration

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.

[Example 3.1] Work Manager configuration: <<jeus-connector-dd.xml>>

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jeus-connector-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus">
    <worker-pool>
        <min>0</min>
        <max>5</max>
        <keep-alive-time>60000</keep-alive-time>
        <shutdown-timeout>-1</shutdown-timeout>
    </worker-pool>
</jeus-connector-dd>


Sub-elements of <worker-pool> are explained in the following table:

TagDescription
<min>The minimum number of threads managed by Work Manager. (Default value: 0)
<max>The maximum number of threads managed by Work Manager. (Default value: 5)
<keep-alive-time>

Additional threads that are created, after the minimum number of threads is reached, are automatically removed from the thread pool if they have not been used for a specified time period. (Default value: 1 minute)

Replaces <pooled-timeout>.

<queue-size>Size of a queue required by the thread pool. (Default value: 4096)
<pre-allocation>Before the Work Manager is initialized, threads up to the <min> value are created. (Default value: true)
<shutdown-timeout>

After a resource adapter is undeployed, the Work Manager will wait for a specified time to be terminated. While waiting, a new request will not be accepted, which means that Graceful Shutdown is supported. (Default value: -1, Terminate without waiting.)

Note

For information about how to include the jeus-connector-dd.xml file into the RAR file, refer to "Chapter 4. Resource Adapter".

3.2. Message Inflow

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.

Note

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.

[Example 3.2] MDB-interoperable resource configuration: <<jeus-ejb-dd.xml>>

<jeus-ejb-dd>
    . . .
    <beanlist>
        <jeus-bean>
           <ejb-name>TestMsgBean</ejb-name>
           <connection-factory-name>QueueConnectionFactory</connection-factory-name>
           <destination>jms/QUEUE1</destination>
           <mdb-resource-adapter-name>app#ra</mdb-resource-adapter-name>
            ...
        </jeus-bean>
    . . .


  • <mdb-resource-adapter-name>

    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'.

Note

A resource adapter should be deployed before MDB is deployed.