Oracle® Application Server Adapter for Tuxedo User's Guide 10g Release 3 (10.1.3.1.0) Part Number B29000-01 |
|
|
View PDF |
To deploy and integrate OracleAS Adapter for Tuxedo with Oracle Application Server Containers for J2EE (OC4J), you need to configure the J2CA 1.5 Tuxedo adapter.
This section includes the following topics:
Oracle Application Server provides a complete Java 2 Enterprise Edition (J2EE) environment that executes on the Java virtual machine (JVM) of the standard Java Development Kit (JDK). OC4J is J2EE certified and provides all J2EE specific containers, APIs, and services. OC4J supports the J2CA 1.5 standards.
J2CA defines standard Java interfaces for simplifying the integration of applications with the EIS. OracleAS adapters are deployed as resource adapters within the OC4J container.
The contract between the OC4J client application and the resource adapter is defined by the common client interface (CCI). The contract between the OC4J container and the resource adapter is defined by the service provider interface (SPI). The SPI API addresses the connection management, transaction management and the security management.
Connection management enables application components to connect to an EIS and leverage any connection pooling provided by the application server.
Transaction management enables an application server to use a transaction manager to manage transactions across multiple resource managers.
Lifecycle management contracts enable an application server to initialize a resource adapter instance during the deployment of the adapter or application server startup. In addition, it enables the application server to notify the resource adapter instance during server shutdown or undeployment of the adapter.
The lifecycle contract provides the mechanism for the application server to manage the lifecycle of the resource adapter instance.
Work management contracts enable the resource adapter to carry out its logic by using threads dispatched by an application server, rather than creating threads on its own. The handshake is done through a Work
instance submission. This makes the application server threads management more efficient, providing better control over their execution contexts (such as security and transaction).
Message inflow, which refers to inbound communications from an EIS to the application server (see "Configuring the J2CA 1.5 Tuxedo Queue Adapter for Inbound").
This section includes the following topics:
To connect to the J2CA 1.5 Tuxedo adapter under Oracle Application Server, you need to set the relevant parameters in the connection factory. You can perform this task by using Oracle Enterprise Manager, or by carrying out the following steps:
Open the following file in an editor:
root\j2ee\home\application-deployment\default\oracle\oc4j-ra.xml
where root
is the Oracle Application Server root directory.
In this file, set the following parameters for each connection.
<oc4j-connector-factories> <connector-factory location=" " connector-name="Oracle Legacy Adapter"> <config-property name="userName" value=" "/> <config-property name="password" value=" "/> <config-property name="eisName" value=" "/> <config-property name="serverName" value=" "/> <config-property name="workspace" value=" "/> <config-property name="portNumber" value=" "/> <config-property name="persistentConnection" value=" "/> <config-property name="keepAlive" value=" "/> <config-property name="firewallProtocol" value=""/> <config-property name="connectTimeout" value=""/> <config-property name="encryptionProtocol" value=""/> <config-property name="encryptionKeyName" value=""/> <config-property name="encryptionKeyValue" value=""/> <config-property name="fakeXA" value=" "/> <config-property name="useNamespace" value=" "/> <config-property name="networkXMLProtocol" value=" "/> <config-property name="exposeEventStreamMetadata" value=" "/> </connector-factory> </oc4j-connector-factories>
Note:
location
is the attribute that specifies the JNDI location where Oracle Application Server should bind the connection factory instance for application components.Table 3-1 provides a detailed description of these parameters.
Table 3-1 OC4J Connection Properties for Outbound Interactions
Property | Description |
---|---|
|
Required. Specifies the JNDI location where Oracle Application Server should bind the connection factory instance for application components. |
|
Required. Sets the name of the adapter to use. The adapter is defined in the Oracle Connect server using Oracle Studio, as described in "Configuring an Oracle Connect Adapter". |
|
Optional. Sets the TCP/IP address or host name where the Oracle Connect daemon is running. See Also: Appendix C, "Advanced Tuning of the Daemon" for details about the daemon. |
|
Optional. Specifies the name of an Oracle Connect server workspace to use. The default workspace is |
|
Optional. Specifies the TCP/IP port where the Oracle Connect daemon is running on the server. The default port is |
|
Optional. Specifies a user who can access the Oracle Connect server. The user is defined in the Oracle Connect daemon configuration. See also: "Daemon Security" and "WS Security" for details about users allowed to access an Oracle Connect server |
|
Optional. Specifies a valid password for the user. |
|
Optional. Set to |
|
Optional. Set to |
|
Optional. Specifies the firewall protocol used: either |
|
Optional. Specifies the connection timeout in seconds. The default is 0, indicating that there is no connection timeout. |
|
Optional. Specifies the name of encryption protocol to use. The default is set to |
|
Optional. Specifies the name of the symmetric encryption key to use. |
|
Optional. Specifies the value of the symmetric encryption key to use. |
|
Optional. When set to |
|
Optional. Set to |
|
Optional. Specifies how the XML is passed over the network. |
|
Optional. When set to |
Each J2CA 1.5 Tuxedo adapter, requires an entry in the oc4j-ra.xml
file as described in "Configuring the J2CA 1.5 Tuxedo Adapter for Outbound".
You can change the configuration settings for a resource adapter by editing the relevant connector-factory
entry in the oc4j-ra.xml
file. For these changes to take effect, you need to stop and restart Oracle Application Server.
You can develop applications to run adapter interactions using the Common Client Interface (CCI) API.
Perform the following steps to use the CCI API with the J2CA 1.5 Tuxedo adapter:
Select a ConnectionFactory
object for the J2CA 1.5 Tuxedo adapter.
Create a Connection
object using the selected ConnectionFactory
. A Connection
is a handle to the underlying network connection to the EIS, which is identified in the oc4j-ra.xml
file by the serverName
property.
Create a Connection
object using the selected ConnectionFactory
. Specify the interaction properties using an AttuInteractionSpec
object. The AttuInteractionSpec
object has the following format:
AttuInteractionSpec(java.lang.String name, int verb, int timeOut)
The following table describes the properties that can be specified:
Table 3-2 Interaction-Spec Properties
Property | Description |
---|---|
|
Specifies the interaction name to be executed. |
|
Specifies the mode for the interaction: |
|
Specifies the time (in milliseconds) to wait for an EIS to run the specified interaction. |
The following is an InteractionSpec sample:
AttuInteractionSpec iSpeq = new AttuInteractionSpec("query", javax.resource.cci.InteractionSpec.SYNC_RECEIVE, 60);javax.resource.cci.RecordFactory rf = new AttuRecordFactory(con, mcf.getLogger()); javax.resource.cci.MappedRecord queryRecord = rf.createMappedRecord("query"), queryRecord.put("##text", "select * from disam:nation"); javax.resource.cci.Record oRec = interaction.execute(iSpec, queryRecord);
Invoke the execute
method on the interaction
to initiate a call to the EIS. Pass any data for the interaction as input and output records.
Once the interactions have been processed, close the Interaction
and Connection
objects.
This section includes the following topics:
The provider of the endpoint must supply the following information in the endpoint deployment descriptor file, called ejb-jar.xml
:
The properties of the ActivationSpec class of the CICS Queue adapter
The type of message listener implemented in the endpoint
The orion-ejb.xml
file must provide the name of the resource adapter.
OC4J searches the deployment descriptor of the resource adapter for the message listener type and sets the properties that are defined in the endpoint deployment descriptor file for the respective ActivationSpec class.
The resource adapter supports message listener types and ActivationSpec classes as follows:
Table 3-3 Message Listener Types and their ActivationSpec Classes
Message Listener Type | ActivationSpec Class |
---|---|
|
|
|
|
Example 3-1 Endpoint Deployment Descriptor (ejb-jar.xml)
<ejb-jar> <display-name>AttuMDB1</display-name> <enterprise-beans> <message-driven> <display-name>Attu Test Receiver Bean</display-name> <ejb-name>AttuTestReceiverBean</ejb-name> <ejb-class>attutestreceiverbean.AttuTestReceiverBean</ejb-class> <messaging-type>javax.resource.cci.MessageListener</messaging-type> <transaction-type>Container</transaction-type> <activation-config> <activation-config-property> <activation-config-property-name>userName</activation-config- property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>password</activation-config- property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>firewallProtocol< /activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>connectTimeout</activation- config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>encryptionProtocol </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>encryptionKeyName </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>encryptionKeyValue </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>workspace </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>portNumber </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>useNamespace </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>networkXMLProtocol </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>idleTimeout </activation-config-property-name> </activation-config-property> <activation-config-property> <activation-config-property-name>messagesInBatch </activation-config-property-name> <activation-config-property-value>1</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>support2PC </activation-config-property-name> <activation-config-property-value>false</activation-config- property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>waitTime </activation-config-property-name> <activation-config-property-value>5</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>retryInterval </activation-config-property-name> <activation-config-property-value>5 </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>eisName </activation-config-property-name> <activation-config-property-value>TUXGetEvents </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>serverName </activation-config-property-name> <activation-config-property-value>drorr-xp </activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>exposeEventStreamMetadata </activation-config-property-name> <activation-config-property-value>true </activation-config-property-value> </activation-config-property> </activation-config> </message-driven> </enterprise-beans> <assembly-descriptor> <!-- NotSupported, Supports, Required, RequiresNew, Mandatory or Never --> <container-transaction> <method> <ejb-name> AttuTestReceiverBean </ejb-name> <method-name> onMessage </method-name> <method-params> <method-param> javax.resource.cci.Record </method-param> </method-params> </method> <trans-attribute> NotSupported </trans-attribute> </container-transaction> </assembly-descriptor> </ejb-jar>
The following table lists the properties that are relevant for inbound interactions.
Table 3-4 OC4J Connection Properties for Inbound Interactions
Property | Description |
---|---|
|
Required. Specifies the JNDI location where Oracle Application Server should bind the connection factory instance for application components. |
|
Required. Sets the name of the adapter to use. The adapter is defined in the Oracle Connect server using Oracle Studio, as described in "Configuring an Oracle Connect Adapter". |
|
Specifies the maximum number of messages that can be moved to an endpoint in batch. The default is set to 1. |
|
Enables global transaction support, where applicable. The default is set to |
|
Defines the maximum time (in seconds) for an empty transaction duration, and for the Tuxedo adapter to return a "no messages" response (which will cause the current transaction to close). The default is set to 30 seconds. |
|
Defines the sleep time after any detected problem before restarting inbound activity. The default is set to 15 seconds. |
|
Optional. Sets the TCP/IP address or host name where the Oracle Connect daemon is running. See Also: Appendix C, "Advanced Tuning of the Daemon" for details about the daemon. |
|
Optional. Specifies the name of an Oracle Connect server workspace to use. The default workspace is |
|
Optional. Specifies the TCP/IP port where the Oracle Connect daemon is running on the server. The default port is |
|
Optional. Specifies a user who can access the Oracle Connect server. The user is defined in the Oracle Connect daemon configuration. See also: "Daemon Security" and "WS Security" for details about users allowed to access an Oracle Connect server |
|
Optional. Specifies a valid password for the user. |
|
Optional. Specifies the firewall protocol used: either |
|
Optional. Specifies the connection timeout in seconds. The default is 0, indicating that there is no connection timeout. |
|
Optional. Specifies the name of encryption protocol to use. The default is set to |
|
Optional. Specifies the name of the symmetric encryption key to use. |
|
Optional. Specifies the value of the symmetric encryption key to use. |
|
Optional. Set to |
|
Optional. Specifies how the XML is passed over the network. |
|
When set to |
The endpoint uses the onMessage
method. The following sample describes how the DOM is received from the CoreDomRecord
class.
Example 3-2 onMessage method
public Record onMessage(Record inMessage)throws javax.resource.ResourceException { … CoreDOMWriter domW; domW = new CoreDOMWriter(false); Element outEl = ((CoreDomRecord)inMessage).getDom(); String xml = domW.toXMLString(outEl); … return null; }
The adapter ignores the return values.
If the Tuxedo Queue adapter describes two types of messages, employee
and department
, the XML data has the following input record structure:
When the exposeEventStreamMetadata
property is set to true
:
<eventStream> < EMPLOYEE> ... </ EMPLOYEE> <DEPARTMENT> ... </DEPARTMENT> </eventStream>
When the exposeEventStreamMetadata
property is set to false
:
<getEventsResponse xmlns="noNamespace://QVREAD"> <event eventName="EMPLOYEE" timestamp="2005-08-23T15:23:18"> < EMPLOYEE> ... </ EMPLOYEE> </event> <event eventName=" DEPARTMENT " timestamp="2005-08-23T15:23:18"> <DEPARTMENT> ... </DEPARTMENT> </event> </getEventsResponse>