To run a transaction in IMS, your Java™ application executes a SYNC_SEND_RECEIVE interaction. Your application provides a value of SYNC_SEND_RECEIVE for the interactionVerb property and a value of 0 or 1 for the commitMode property of the IMSInteractionSpec object used by the execute method. However, the SYNC_SEND_RECEIVE interaction processing is different for shareable and dedicated persistent socket connections.
The IMS TM Resource Adapter, with the application server, obtains either an available connection from the connection pool or creates a new connection. The IMS TM Resource Adapter, as part of initalizing a new connection generates a clientID for the connection. The generated clientID identifies the socket connection, and in the case of commit mode 0 interactions, the TPIPE and associated OTMA Asynchronous Hold Queue.
The IMS resource adapter ensures that a socket is associated with the connection and sends the request with input data to IMS Connect using that socket. IMS Connect then sends the message to IMS, where IMS runs the transaction and returns the output message.
For commit mode 0 interactions, on receiving the output message, the IMS TM Resource Adapter internally sends an ACK message to IMS which signals IMS to discard the output from the IMS queue. When the client application closes the connection or terminates, the connection is returned to the connection pool for reuse by other commit mode 0 or commit mode 1 interactions.
To retrieve undelivered output from a reroute destination, a separate client application can issue a SYNC_RECEIVE_ASYNCOUTPUT_SINGLE_NOWAIT or SYNC_RECEIVE_ASYNCOUTPUT_SINGLE_WAIT interaction on a dedicated persistent socket connection. That client application will provide the reroute destination as the clientID of the interaction.
Alternatively, to retrieve undelivered output from a reroute destination, a separate client application can issue a SYNC_RECEIVE_ASYNCOUTPUT or SYNC_RECEIVE_ASYNCOUTPUT_SINGLE_NOWAIT or SYNC_RECEIVE_ASYNCOUTPUT_SINGLE_WAIT interaction on a shareable persistent socket connection by specifying the alternate clientID. Using the alternate clientID, that client application can retrieve undelivered asynchronous output messages from any TPIPE.
When the client application closes the connection or terminates, the connection is returned to the connection pool so it can be re-usedby other commit mode 0 or commit mode 1 interactions.
Under normal circumstances, when a commit mode 0 SYNC_SEND_RECEIVE interaction is executed by a client application, the application server returns an existing connection with the user-specified clientID, or creates a new connection with the user-specified clientID. The user-specified clientID identifies the socket connection and the TPIPE and associated OTMA Asynchronous Hold Queue.
The IMS TM Resource Adapter ensures that a socket is associated with the connection and sends the request with input data to IMS Connect using that socket. IMS Connect then sends the message to IMS, where IMS runs the transaction and returns the output message. On receiving the output message, the IMS TM Resource Adapter internally sends an ACK to IMS which signals to discard the output from the IMS queue. When the connection is closed or the application terminated, the connection is returned to the connection pool for re-use by another application that is running a commit mode 0 interaction with the same user-specified clientID.
All errors result in a resource exception being thrown to the client application. In addition, some errors result in the socket being disconnected by IMS Connect. In the case of commit mode 0 interactions, this means the output message cannot be delivered to the client application. The undelivered output is queued to the TPIPE associated with the user-specified clientID.
The properties, purgeAsyncOutput and reRoute are not applicable to dedicated persistent sockets. You can not purge or reroute undelivered output messages on a dedicated persistent socket.
If an execution timeout occurs, the socket remains open and the output of the commit mode 0 interaction is queued to the TPIPE associated with the user-specified clientID for later retrieval. When the connection is closed or the application terminated, the IMSManagedConnection object is returned to the connection pool for re-use by another application that is running a commit mode 0 interaction with the same user-specified clientID.