Using the client-managed conversation state programming model

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

  1. 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.
  2. 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.
  3. Set the IMSInteractionSpec commitMode property to 1.
  4. Set an appropriate value for the syncLevel property based on your application design.
  5. On the first iteration, set the IMSInteractionSpec convID property value to an empty string.
  6. 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.
  7. 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.