- In this exercise we will add the "Delay" extension. It provides <ext-delay>,
<ext-wait>, and <ext-sleep> elements that can be used in your STAX jobs to delay
for a specified number of seconds. In the STAX Monitor, these elements will
be displayed in the "Active Job Elements" tree as progress bars.
-
Edit your STAF.cfg file and add
PARMS "EXTENSION C:/STAFCD/Part4/extensions/ExtDelay.jar"
to the STAX service configuration statement. This statement should now look like:
service stax library JSTAF execute c:/staf/services/stax/STAX.jar \
PARMS "EXTENSION C:/STAFCD/Part4/extensions/ExtDelay.jar"
-
Restart STAFProc on your machine.
-
Open your favorite text editor, and copy/paste the following STAX job:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "stax.dtd">
<stax>
<defaultcall function="test"/>
<function name="test">
<parallel>
<block name="'Block A'">
<parallel>
<stafcmd>
<location>'local'</location>
<service>'delay'</service>
<request>'delay 10000'</request>
</stafcmd>
<ext-delay>20</ext-delay>
</parallel>
</block>
<block name="'Block B'">
<ext-sleep>30</ext-sleep>
</block>
<block name="'Block C'">
<parallel>
<ext-delay>10</ext-delay>
</parallel>
</block>
<block name="'Block D'">
<parallel>
<ext-wait>8</ext-wait>
</parallel>
</block>
</parallel>
</function>
</stax>
-
Save the file and run it via the STAX Monitor. You should see 4 progress
bars, representing the Delay elements, in the "Active Job Elements" tree. Also
note that STAX extensions can provide aliases (you can use <ext-delay>,
<ext-sleep>, or <ext-wait>, which all do the same thing).