|Note:||For more information on conversational communications for BEA Tuxedo, see.|
The following sections provide information on conversations and how to define and manage them in your applications:
WebLogic Tuxedo Connector supports BEA Tuxedo conversations as a method to exchange messages between WebLogic Server and Tuxedo applications. In this form of communication, a virtual connection is maintained between the client and the server and each side maintains information about the state of the conversation. The process that opens a connection and starts a conversation is the originator of the conversation. The process with control of the connection is the initiator; the process without control is called the subordinate. The connection remains active until an event occurs to terminate it.
During conversational communication, a half-duplex connection is established between the initiator and the subordinate. Control of the connection is passed between the initiator and the subordinate. The process that has control can send messages (the initiator); the process that does not have control can only receive messages (the subordinate).
WebLogic Tuxedo Connector JATMI conversations have the following characteristics:
Use the following WebLogic Tuxedo Connector primitives when creating conversational clients and servers that communicate between WebLogic Server and Tuxedo:
Use to abort a connection and generate a TPEV_DISCONIMM event.
The following sections provide information on how to create conversational clients and servers.
Follow the steps outlined into create WebLogic Tuxedo Connector conversational clients. The following section provide information on how to use tpconnect to open a connection and start a conversation.
A WebLogic Tuxedo Connector conversational client must establish a connection to the Tuxedo conversational service. Use the JATMI primitive tpconnect to open a connection and start a conversation. A successful call returns an object that can be used to send and receive data for a conversation.
The following table describes
Pointer to the data buffer. When establishing a connection, you can send data simultaneously by setting the data parameter to point to a buffer. The
TPSENDONLY: specifies that the control is being retained by the originator. The called service is subordinate and can only receive data. Do not use in combination with
TPRECVONLY: specifies that control is being passed to the called service.The originator becomes subordinate and can only receive data. Do not use in combination with
TPNOTRAN: specifies that when svc is invoked and the originator is transaction mode, svc is not part of the originator's transaction. A call remains subject to transaction timeouts. If svc fails, the originator's transaction is unaffected.
TPNOBLOCK: specifies that a request is not sent if a blocking condition exists. If
TPNOTIME: specifies that the originator will block indefinitely and is immune to blocking timeouts. If the originator is in transaction mode, the call is subject to transaction timeouts.
The following provides a code example to use tpconnect to start a conversation:
ctx = new InitialContext();
tcf = (TuxedoConnectionFactory) ctx.lookup ("tuxedo.services.TuxedoConnection");
myTux = tcf.getTuxedoConnection();
myConv = myTux.tpconnect("CONNECT_SVC",null,flags);
Follow the steps outlined into create WebLogic Tuxedo Connector conversational servers.
Once a conversational connection is established between a WebLogic Server application and a Tuxedo application, the communication between the initiator (sends message) and subordinate (receives message) is accomplished using send and receive calls. The following sections describe how WebLogic Tuxedo Connector applications use the JATMI primitives tpsend and tprecv:
Use the JATMI primitive tpsend to send a message to a Tuxedo application.
The following table describes
TPRECVONLY: specifies that after the initiator's data is sent, the initiator gives up control of the connection. The initiator becomes subordinate and can only receive data.
TPNOBLOCK: specifies that the request is not sent if a blocking condition exists. If
TPNOTIME: specifies that an initiator is willing to block indefinitely and is immune from blocking timeouts. The call is subject to transaction timeouts.
Use the JATMI primitive tprecv to receive messages from a Tuxedo application.
The following table describes
TPNOBLOCK: specifies that
TPNOTIME: specifies that
A conversation between WebLogic Server and Tuxedo ends when the server process successfully completes its tasks. The following sections describe how a conversation ends:
A WebLogic Server conversational server ends a conversation by a successful call to
return. A TPEV_SVCSUCC event is sent to the Tuxedo client that originated connection to indicate that the service finished successfully. The connection is then disconnected in an orderly manner.
A Tuxedo conversational server ends a conversation by a successful call to
tpreturn. A TPEV_SVCSUCC event is sent to the WebLogic Tuxedo Connector client that originated connection to indicate that the service finished successfully. The connection is then disconnected in an orderly manner.
The order in which an conversation ends is important to gracefully end hierarchal conversations.
Assume there are two active connections: A-B and B-C. If B is a WebLogic Tuxedo Connector application in control of both connections, a call to
return has the following effect: the call fails and a TPEV_SVCERR event is posted on all open connections, and the connections are closed in a disorderly manner.
In order to terminate both connections in an orderly manner, the application must execute the following sequence:
Conversational services can make request/response calls. Therefore, in the preceding example, the calls from B to C may be executed using tpacall()or tpcall()instead of tpconnect. Conversational services are not permitted to make calls to
WebLogic Server conversational clients or servers execute a disorderly disconnect is through a call to tpdiscon. This is the equivalent of "pulling the plug" on a connection.
A call to
WebLogic Tuxedo Connectoruses five events to manage conversational communication. The following table lists the events, the functions for which they are returned, and a detailed description of each.
The connection has been torn down and no further communication is possible. The JATMI
The connection has been torn down and no further communication is possible. The Tuxedo
Use the following guidelines while in conversation mode to insure successful completion of a conversation:
MAXCONVparameter), TPEV_DISCONIMM is the expected WebLogic Tuxedo Connector exception value.
tpforwardto another conversational service, TPEV_DISCONIMM is the expected WebLogic Tuxedo Connector exception value.
TPENOENT, the remote domain will send back a disconnect event message and be caught on the WebLogic Tuxedo Connector application tprecv as a TPEV_DISCONIMM exception.