function Instance_Default_Rule (p_subscription_guid in raw, p_event in out wf_event_t) return varchar2;
Sends the event to all existing workflow process instances that have eligible receive event activities waiting to receive it. This rule function lets you use a business key attribute to identify one or more workflow processes that should receive the event, instead of sending the event to one particular process based on a specific item type, process name, and item key, as with Default_Rule().
Note: Instance_Default_Rule() only sends the event to continue existing workflow processes. If you want to send the event to launch a new process instance, use Default_Rule() instead.
First, Instance_Default_Rule() calls SetParametersIntoParameterList() to set any parameter name and value pairs from the subscription parameters into the PARAMETER_LIST attribute of the event message.
Next, the function searches for existing workflow processes that are eligible to receive this event. To be eligible, a workflow process must meet the following requirements:
The process includes a receive event activity with an activity status of NOTIFIED, meaning the process has transitioned to that activity and is waiting to receive the event.
The event filter for the receive event activity is set to one of the following values:
This individual event
An event group of which this event is a member
NULL, meaning the activity can receive any event
The receive event activity has an activity attribute named #BUSINESS_KEY whose default value is an item type attribute.
The current value of that item type attribute matches the event key.
After sending the event to all eligible workflow processes, Instance_Default_Rule() also sends the event message to an agent, if specified in the subscription definition.
If any operations raise an exception, Instance_Default_Rule() traps the exception, stores the error information in the event message, and returns the status code ERROR. Otherwise, Instance_Default_Rule() returns the status code SUCCESS.
Note: Instance_Default_Rule() may take some time to complete, depending on how many existing workflow processes include receive event activities, how many of those processes are eligible to receive this event, and what activities in those processes the Workflow Engine must execute after the event has been received. Consequently, when you use Instance_Default_Rule() as the rule function for a subscription, it is strongly recommended that you set the phase number for the subscription to 100 or higher to defer the subscription and allow the rule function processing to be completed in the background by an agent listener.
| p_subscription_guid | The globally unique identifier of the subscription. |
| p_event | The event message. |