For the client application to manage all iterations in
a conversation, the useConvID property of the IMSInteractionSpec class
must be set to true.
About this task
To enable your Java client for IMS™ conversational transactions by using the
client-managed conversation state programming model:
Procedure
- Obtain a connection handle from the IMSConnectionFactory object.
In this programming model, you can use the same or different connection
handles in subsequent iterations. These connection handles must come
from the same IMSConnectionFactory. instance.
- Set the IMSInteractionSpec useConvID
property to true. This property needs to remain true
for all iterations of the conversation. If the useConvID flag changes
during a conversation, an error would occur.
- Set the IMSInteractionSpec commitMode
property to 1.
- Set an appropriate value for the syncLevel property based
on your application design.
- On the first iteration, set the IMSInteractionSpec convID
property value to an empty string.
- On all iterations other than the first iteration, set the
value of the convID property to the value of the convID property that
is returned in the previous iteration.
- If the client application controls the ending of a conversation,
on the last iteration, set the IMSInteractionSpec interactionVerb
property to SYNC_END_CONVERSATION.
Recommendation: With the client-managed conversation
state programming model, use local references per request in your
client application or servlet instead of application-wide references.
This approach is to avoid any race conditions that might occur in
the client application due to stress or load that could violate the
integrity of the conversational data. If the client application is
browser-based, you need to carefully design the navigation so that
the conversational request does not get resubmitted accidentally.
This scenario can happen if the user presses the back button on the
browser, which causes the conversational request to be resubmitted
again and therefore results in an additional conversation.