Retrieving synchronous callout request messages from non-MDB applications

You must modify the Java™ application to retrieve the callout requests in the hold queue and to handle the correlation of the response to the appropriate request.

Before you begin

Prerequisite: Your WebSphere® Application Server administrator must configure a shareable connection factory to be used by the Java application to retrieve the callout requests.

About this task

The following steps are key steps in a Java application for retrieving and responding to a synchronous callout request from IMS™.

Procedure

  1. To retrieve the synchronous callout request:
    1. Set the interaction commit mode to 0 (COMMIT_THEN_SEND).
      interactionSpec.setCommitMode(IMSInteractionSpec.COMMIT_THEN_SEND); 
    2. Set the interaction sync level to CONFIRM.
      interactionSpec.setSyncLevel(IMSInteractionSpec.SYNC_LEVEL_CONFIRM); 
    3. Specify the callout queue name to the OTMA tpipe (hold queue) name.
      // An 8-character name of the OTMA asynchronous hold queue that the 
      // messages are to be retrieved from
      String calloutQueueName = new String (“CALLOUTQ”);
      // Set the queue name for the callout messages
      interactionSpec.setAltClientID(calloutQueueName);
    4. Set the interaction verb to SYNC_RECEIVE_CALLOUT.
      interactionSpec.setInteractionVerb(IMSInteractionSpec.SYNC_RECEIVE_CALLOUT);
    5. Specify the type of callout request to retrieve: synchronous only (CALLOUT_REQUEST_SYNC), asynchronous only (CALLOUT_REQUEST_ASYNC), or both (CALLOUT_REQUEST_BOTH). The following example retrieves only synchronous callout request messages.
      // Specify to retrieve only synchronous callout request messages
      interactionSpec.setCalloutRequestType(IMSInteractionSpec.CALLOUT_REQUEST_SYNC); 
    6. Specify the execution timeout value. The following example sets the timeout value to 5 seconds.
      interactionSpec.setExecutionTimeout(5000);
    7. Execute the interaction. The following example executes the interaction, and the request is returned as calloutRequestMsg.
      iteraction.execute(interactionSpec, null, calloutRequestMsg); 
  2. Obtain the correlation token from the IMSInteractionSpec instance. The following example sets the timeout value to 5 seconds.
    byte[] corrToken = interactionSpec.getSyncCalloutCorrelationToken();
  3. Process the request. In the previous example, the request is returned as calloutRequestMsg.
  4. Send the response.
    1. Set the interaction verb to SYNC_SEND.
      interactionSpec.setInteractionVerb(IMSInteractionSpec.SYNC_SEND); 
    2. Set the correlation token to be sent back with the request.
      interactionSpec.setSyncCalloutCorrelationToken(corrToken); 
    3. Execute the interaction. The following example executes the interaction and sends the callout response message (calloutRespondMsg).
      iteraction.execute(interactionSpec, calloutRespondMsg, null);