Search Results

Catching Activity Faults with Scope and Fault Handlers

A scope and fault handler is defined for activities within a process. The handler catches faults that have been triggered within the scope.

If accessing the sample from the TIBCO Business Studio Welcome page, go directly to Step 3.

Procedure

  1. In the samples directory in the File Explorer view, expand core > fault > ScopeAndFaultHandler and double-click tibco_bw_sample_core_fault_scopeandfaulthandler.zip to expand it in the Project Explorer. See Accessing Samples for more information.
  2. In Project Explorer, expand the tibco_bw_sample_core_fault_ScopeAndFaultHandler.
  3. Fully expand the Processes directory and double-click ScopeFault.bwp to open it in the Process Editor pane.
  4. Click Run > Debug Configurations.
  5. In the Debug Configuration wizard, expand BusinessWorks Application in the left pane and select BWApplication
  6. Click the Applications tab and then click the Deselect All button if you have multiple applications selected. Select the check box next to tibco_bw_sample_core_fault_scopeandfaulthandler_application.
  7. Click Debug. This will run the sample in Debug mode.
  8. Click the Terminate icon to stop the process.
    The console displays the messages based on the value specified in the input XML provided in the ParseXML activity.

    12:49:31.510 INFO [bwEngThread:In-Memory Process Worker-1] c.t.b.p.g.L.t.Log - The mortgage rate is: 3.5

  9. Optionally, push your application to the cloud. For details on how to do this see Pushing an Application to the Cloud.

Understanding the Configuration

Fault handler mechanism is based on the type of input provided in the ParseXML activity. Catch scope specified at activities level will be executed for any invalid XML input data.

If the XML content specified in ParseXML activity is valid and selected Credit Profile is within the input XML, Success message "The mortgage rate is: 3.5" is displayed for a selected credit profile.

If the XML content specified in ParseXML activity is not valid, activity Scope Catch block is executed for XML Parse exception.

CatchAll scope specified at process level will be executed for occurrence of any other type of exceptions.