5. OnFault processing in parent process (error from child process

Mirjana's picture
Now, we will show 2 processes, a parent and child one:
 
Parent process:
 
 
<process name="default">
 <sequence name="mainParentSequence">
    <operation name="Invoke Business Process Service">
      <participant name="InvokeBusinessProcessService"/>
      <output message="InvokeBusinessProcessServiceTypeInputMessage">
        <assign to="." from="*"></assign>
        <assign to="INVOKE_MODE">SYNC</assign>
        <assign to="WFD_NAME">TEST_onFault_childProcess</assign>
        <assign to="NOTIFY_PARENT_ON_ERROR">NONE</assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
 
    <onFault>
      <sequence>
        <assign name="Assign" to="ERROR_PARENT">Error processed by the parent process</assign>
      </sequence>
    </onFault>
 </sequence>
</process>
 
 
Child process:
 
 
 
<process name="default">
 <sequence name="mainChildSequence">
    <assign name="Assign" to="firstSequenceVar_1">1_1</assign>
    <operation name="File System Adapter">
      <participant name="FS_InstallValidation"/>
      <output message="FileSystemInputMessage">
        <assign to="." from="*"></assign>
        <assign to="Action">FS_COLLECT</assign>
        <assign to="filter">*.txt</assign>
        <assign to="deleteAfterCollect">false</assign>
      </output>
      <input message="inmsg">
        <assign to="." from="*"></assign>
      </input>
    </operation>
 
    <assign name="Assign" to="firstSequenceVar_2">1_2</assign>
    <onFault code="No files to collect">
      <sequence name="Sequence Start">
        <assign name="Assign" to="ERROR_CHILD">Error processed by child process</assign>
      </sequence>
    </onFault>
    <onFault>
      <sequence name="Sequence Start">
        <operation name="Business Process Metadata">
          <participant name="BPMetaDataInfoService"/>
          <output message="BPMetaDataServiceTypeInputMessage">
            <assign to="." from="*"></assign>
            <assign to="TRACE">TRUE</assign>
          </output>
          <input message="inmsg">
            <assign to="." from="*"></assign>
          </input>
        </operation>
 
        <operation name="XSLT Service">
          <participant name="XSLTService"/>
          <output message="XSLTServiceTypeInputMessage">
            <assign to="." from="*"></assign>
            <assign to="xslt_name">TEST_error</assign>
            <assign to="xml_input_from">ProcData</assign>
            <assign to="input_pd_xpath">/</assign>
          </output>
          <input message="inmsg">
            <assign to="." from="*"></assign>
          </input>
        </operation>
 
        <operation name="Mail Mime Service">
          <participant name="MailMimeService"/>
          <output message="MailMimeServiceInputMessage">
            <assign to="." from="*"></assign>
            <assign to="mail-mime-subject">GIS error in sequence 1</assign>
            <assign to="mail-mime-sender">GIS_admin</assign>
            <assign to="mail-mime-operation">build</assign>
            <assign to="mail-mime-recipient">mirjana.vojvodic@tis.hr</assign>
          </output>
          <input message="inmsg">
            <assign to="." from="*"></assign>
          </input>
        </operation>
 
        <operation name="SMTP Send Adapter">
          <participant name="SMTP_SEND_ADAPTER"/>
          <output message="SMTP_SEND_ADAPTERInputMessage">
            <assign to="." from="*"></assign>
            <assign to="xport-smtp-mailto">mirjana.vojvodic@tis.hr</assign>
            <assign to="xport-smtp-mailhost">192.168.100.128</assign>
            <assign to="b2b-raw-message">true</assign>
            <assign to="xport-smtp-mailport">25</assign>
          </output>
          <input message="inmsg">
            <assign to="." from="*"></assign>
          </input>
        </operation>
 
      </sequence>
    </onFault>
 </sequence>
</process>
 
5.1         If there is OnFault in a child process, as well as in the parent process, then any error will be processed by a child process in the same way as it is shown in topics 2, 3 and 4
 
 
 
 
 
Process Data:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
 <firstSequenceVar_1>1_1</firstSequenceVar_1>
 <Prev_NotSuccess_Adv_Status>No files to collect</Prev_NotSuccess_Adv_Status>
 <ERROR_SERVICE>
    <WFD_NAME>TEST_onFault_childProcess</WFD_NAME>
    <SERVICE_NAME>FS_InstallValidation</SERVICE_NAME>
    <STEP_ID>2</STEP_ID>
    <ADV_STATUS>No files to collect</ADV_STATUS>
    <BASIC_STATUS>1</BASIC_STATUS>
    <WFC_ID>lin2:node1:12728cff242:5532968</WFC_ID>
 </ERROR_SERVICE>
 <ERROR_CHILD>Error processed by child process</ERROR_CHILD>
</ProcessData>
 
For any NOTIFY_PARENT_ON_ERROR mode, error will always be handled by a child process.
 
Process state:
 
Parent process will finish with green light and Completed state, and
Child process will finish with red light and also Completed state.
 
 
 
5.1.1 OnFault in a child process, but OnFault processing fails in a child process
 
 
 
 
Process Data:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
 <firstSequenceVar_1>1_1</firstSequenceVar_1>
 <Prev_NotSuccess_Adv_Status>34</Prev_NotSuccess_Adv_Status>
 <ERROR_SERVICE>
    <WFD_NAME>TEST_onFault_childProcess</WFD_NAME>
    <SERVICE_NAME>FS_InstallValidation</SERVICE_NAME>
    <STEP_ID>2</STEP_ID>
    <ADV_STATUS>No files to collect</ADV_STATUS>
    <BASIC_STATUS>1</BASIC_STATUS>
    <WFC_ID>lin2:node1:12728cff242:5577605</WFC_ID>
    <WFD_NAME>TEST_onFault_childProcess</WFD_NAME>
    <SERVICE_NAME>BPExceptionService</SERVICE_NAME>
    <STEP_ID>5</STEP_ID>
    <ADV_STATUS>34</ADV_STATUS>
    <BASIC_STATUS>1</BASIC_STATUS>
    <WFC_ID>lin2:node1:12728cff242:5577638</WFC_ID>
 </ERROR_SERVICE>
 <ERROR_CHILD>Error processed by a child process</ERROR_CHILD>
 <ERROR_PARENT>Error processed by the parent process</ERROR_PARENT>
</ProcessData>
 
Both processes finishes with red light but completed statuses, as an error in child process is handled by its own OnFault, but error that was thrown in child’s OnFault is handled by a parent’s OnFault:
 
 
 
5.2         OnFault omitted in a child process
 
If OnFault is omitted in a child process, any error can be handled by a parent process, but it depends on NOTIFY_PARENT_ON_ERROR parameter in Invoke BP Service.
 
5.2.1 NOTIFY_PARENT_ON_ERROR: Continue parent if any type error occurs in sub-process
 
Process flow:
 
  
 
 
Process Data:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
 <firstSequenceVar_1>1_1</firstSequenceVar_1>
 <Prev_NotSuccess_Adv_Status>No files to collect</Prev_NotSuccess_Adv_Status>
 <ERROR_SERVICE>
    <WFD_NAME>TEST_onFault_childProcess</WFD_NAME>
    <SERVICE_NAME>FS_InstallValidation</SERVICE_NAME>
    <STEP_ID>2</STEP_ID>
    <ADV_STATUS>No files to collect</ADV_STATUS>
    <BASIC_STATUS>1</BASIC_STATUS>
    <WFC_ID>lin2:node1:12728cff242:5591256</WFC_ID>
 </ERROR_SERVICE>
 <ERROR_PARENT>Error processed by the parent process</ERROR_PARENT>
</ProcessData>
 
Process state:
 
 
 
5.2.2 NOTIFY_PARENT_ON_ERROR: Halt sub-process if any error occurs (for potential correction and resume)
 
Process flow:
 
 
 
 
Process State:
 
 
Error is not handled in this case. Process is waiting for correction and resume!