Examples

Add the sample TPS procs for processing and rollback.

Two states are used in processing:

START -> state_1
state_1 -> state_2
state_2 -> STOP
  • DTC generates the XID and forwards a new message to START.

    From Start if DONE is returned.

  • DTC forwards the message to state_2.

    From Start if ENRICH is returned.

  • DTC forwards the message to state_1.
    • state_1 forwards all messages to a thread named pix.
    • state_1 returns all replies with a code of DONE.
  • DTC forwards to state_2.

    state_2 returns all messages with a code of FINISH.

  • DTC forwards to STOP.

DTC Tcl procs are normal TSP procs. DTC procs overload the dispList with additional properties.

Some metadata is modified by the Tcl procs.

  • start.tps
    set xCode ENRICH
    lappend dispList "DTCNEXT {{$mh $xCode}}"
  • state_1 forwards to thread pix.
    dtcset $dtcctx mykey1 $data
    lappend dispList "DTCSEND $mh"
  • The pix thread receives the message from state_1, modifies the message, and returns the message to state_1.
    msgmetaset $reply DESTCONN HIE
    lappend dispList "OVER $reply"
  • state_1 receives replies from thread pix.
    set xCode DONE
    lappend dispList "DTCNEXT {{$mh $xCode}}"
  • state_2 forwards all message to last step.
    set data [msgget $mh]
    #Notify DTC that message is finished
    set xCode FINISH
    lappend dispList "DTCNEXT {{$mh $xCode}}"    
    # create a new message and send it to xlate thread
    set mh2 [msgcreate $data]
    lappend dispList "OVER $mh2"