Handling the timeout exception—Timer event

As you are aware, you have a Finalize Contract task. The idea is that contract finalization should be completed in a one-hour time frame. If the task is not completed in one hour, a Timer event attached to the task will catch the Human Task timeout. You will develop a subprocess to save quote with the status SLAVoilated, and when timeout happens on the Human Task, the process token will reach the subprocess and save quote to a location with the status "SLAVoilated".

How to do it...

I. Create a Catch subprocess

  1. Go to Component Palette | BPM | Activities and click on Sub Process.
  2. Click just below the Finalize Human task in the Contracts swimlane.
  3. This will open the Properties dialog. In the Properties | Basic tab, enter the name of the subprocess as CatchSLA. Keep the default settings for the other tabs.
  4. Name the Start and End events of the subprocess as CatchSLAError and EndSLAError respectively.
  5. Let the Implementation type for both CatchSLAError and EndSLAError be None.
  6. Go to Component Palette | BPM | Activities and click on Service Task.
  7. Click between the CatchSLAError and EndSLAError activities in the subprocess. This will open the Properties dialog.
  8. In Properties, enter name of the service task as "SaveSLAVoilatedQuote".
  9. In the Implementation tab, select Service Call from the Implementation drop-down.
  10. Click on the "browse" button to the right of the of Name field and select SaveQuote from the list.
  11. Place a check next to Data Associations and click the pencil button to edit.
  12. In the Data Associations editor, drag quote from the Data object list into the input section and enter "SLAViolated" as quoteRequestStatus.
    How to do it...
  13. Click OK.
  14. When you have finished, click Save.

II. Create a Timer event

  1. Go to Component Palette | BPM | Events and click on Timer Catch Events.
  2. This will open the Properties dialog.
  3. Enter ThrowSLAVoilation as the name for the Timer Catch Event.
  4. In the Implementation tab, select Implementation Type as Timer and tick Interrupting Event.
  5. In the interrupting Boundary Timer Event, process execution does not continue on the normal sequence flow and executes the exception flow path.
  6. Specify a time period in the Time Cycle. Let's set it to 1 minute for the time being, to facilitate testing. However, it should be 1 hour for this scenario.
    How to do it...
  7. Click OK.
  8. Create a default sequence flow from the Timer Event CatchSLAVoilation to CatchSLA subprocess.
  9. When you have finished, click Save.

How it works...

The process token reached the Finalize Contract Human Task and the task is assigned to the Contracts user to finalize it. A timer implies that if the task is not completed in one hour, the Catch Timer event will execute and the process token will follow the sequence path defined for the Timer Catch event and will reach the CatchSLA subprocess. This subprocess will save the quote with the SLAVoilated request status.

There's more...

You have invoked the SaveQuote service twice. Let's build a Catch All for the system exception if it occurs while invoking SaveQuote.

Catch all system exceptions

  1. Go to Component Palette | BPM | Activities and click on Event Subprocess.
  2. Enter CatchSystemExceptions as the name of the Event Subprocess activity.
  3. Rename the Start activity in Event Subprocess as CatchAllSystemExceptions.
    Catch all system exceptions
  4. In the Implementation tab, select Implementation Type as Error and tick Catch all system exceptions.
  5. Tick Use Data Associations and click the pencil button to edit.
  6. In the Data Associations editor, drag the Data object quote into variables and assign quote Data object to it, as shown in the preceding screenshot.
  7. Click OK twice, to reach the designer.
  8. Go to Component Palette | BPM | Activities and click on Script Task.
  9. Click between the Start and End activity in Event Subprocess. This will open the Script Task Properties dialog.
  10. Enter SystemException as the name of the Script Task.
    Catch all system exceptions
  11. In the Implementation tab, tick Data Associations and click the pencil button to edit.
  12. In the Data Associations editor, drag quote as input and assign EndWithSystemException to quoteRequestStatus.
  13. Click OK twice.
  14. When you have finished,click Save.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.74.211