Deferred synchronous reply handling

In the deferred synchronous model, the Client application issues a server request call and then continues immediately with the next statement without waiting for a reply.

Unlike the asynchronous case, where a server reply is handled immediately it arrives, the client decides when it wants to poll for a reply.

When a poll is issued, the flow object checks whether there is, in fact, a reply from the original server request. If there is, the flow object's reply handler is called synchronously and is passed the returned communication area in a buffer object. Poll returns a value to its caller indicating whether the reply was received or not; if not it can try again later.

The same simple subclass of the flow class described above is used. There are some small changes to the main Client application to indicate deferred synchronous reply handling:
  …
MyCclECI myeci;
CclConn server1( argv[1],argv[2],argv[3] );
CclBuf  comma1( argv[4] );
MyCclFlow dsflow( Ccl::dsync );
server1.link( dsflow,"ECIWTO",&comma1 );
  …
For demonstration purposes, the Client application is now made to loop with a delay until poll indicates the reply has been received from the server. Note that in the deferred synchronous model, a buffer object to hold the returned communication area can be supplied as a parameter to the poll method. If, as in the following example, no buffer object is supplied on the poll method, one is allocated internally within the flow object, and is deleted after the reply handler has run.
  …
Ccl::Bool reply = Ccl::no;
while ( reply == Ccl::no ) {
  cout << "DSync polling…" << endl;
  reply = dsflow.poll();
  if ( reply == Ccl::no ) DosSleep( msecs );
  }
  …
Typical output on successful completion would look like this:
DSync polling…
DSync polling…
DSync polling…
Reply from CICS server: Hello World

As in the asynchronous model, the wait method can be used to make a deferred synchronous flow synchronous, blocking the client.


Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/dsync.html