Search from 700 + Posts

Dec 21, 2010

WBP, Cost of activity and Defer activity in Oracle Workflow

This is a very short post related to
  1. Deferred activity, 
  2. How to make an activity a deferred activity and 
  3. What are the signifiance of Minimum Threshold and Maximum Threshold parameter for workflow background process.
Deferred activity is executed off-line in other wards it is an activity deferred to a background engine for execution.

There are two ways to mark an activity as deferred activity.
  • Assign a cost higher than a designated threshold to a background process. The engine then continues processing the next pending eligible activity that may occur in another parallel branch of the process.The default threshold for the Workflow Engine is 50 hundredths of a second. Activities with a cost higher than this are deferred to background engines. 
  • Explicit creates a defer activity as associating PL/SQL procedure named WF_STANDARD.DEFER with it.
Please note that Method#1 mark any activity as deferred activity and it will be refer to workflow background for execution. Generally we should assign Complex, long running activities a high cost.

where as Method#2 is to define an explicit defer activity.eg. Defer-Fulfillment or Invoice Interface - Deferred activities in Oracle Order Management Flow.

Please Note that out of 5 parameters that are assocaited with the workflow background process, 2 are  Minimum Threshold and Maximum Threshold.

By using Minimum Threshold and Maximum Threshold we can create multiple background engines to handle very specific types of activities. For example, if we only want to process activities with a certain cost, we can set both the Minimum Threshold and the Maximum Threshold to that value. The default values for these arguments are 0 and 100 so that the background engine runs activities regardless of cost.

NOTE - These Threshold parameters are only to process the Defer activities that have been mark as defere because of cost > 50  

Let me explain with example - let's say we have 3 processes
  1. First with default Cost (0) ,
  2. Second with cost 70 and
  3. Third with cost 80.
  4. 4th with cost 75
First process will always be Online process and will never be defer to the workflow background process on the other hand second/third/4th will always defer.

We can process 2nd/3rd/4th together by means of scheduling the workflow background process with Min Threshold parameter = 70 and Max threshold parameter = 80 or we can schedule 2 different process with
WBP#1 Min Threshold parameter = 70 and Max threshold parameter = 70
WBP#2 Min Threshold parameter = 70 and Max threshold parameter = 80

WBP#1 will pick activity with Cost 70 and WBP#2 will pick the activity with cosr = 80 amd 4th process will not be process at all.

Please Note that WBP#1/WBP#2 will not process any of the Defer activity where cost <>70/80 OR activity Defered because of the API WF_STANDARD.DEFER.


Hope that is helpful.

No comments:

Post a Comment