Monday Aug 02, 2010

PLSQL vs Java Business Event System

Oracle Workflow provides Business Event System implementation within the database (PLSQL) and in the middle tier (Java). The implementation is exactly the same in terms of the event subscription processing in both these layers but the only difference is how the Developer wants to leverage Business Event System's capabilities for event processing requirements. With the availability of Business Event System implementation in PLSQL and Java, different subscription processing scenarios can be achieved.

Subscription Scenarios

    1. Execute PLSQL rule function synchronously or asynchronously. Oracle Workflow provides a bunch of default rule functions in WF_RULE package for your use
    2. Execute Java rule function synchronously or asynchronously. Oracle Workflow provides a default rule function oracle.apps.fnd.wf.bes.WebServiceInvokerSubscription to invoke web services
    3. Launch workflow process
    4. Send event to an agent (AQ)

Event Raise APIs

Workflow Business Events can be raised using one of two following ways.

    1. PLSQL API WF_EVENT.Raise
    2. Java method oracle.apps.fnd.wf.BusinessEvent.raise

Testing Business Events

Starting 12.1.1 and 11.5.10.ATG RUP7 releases, Test Business Event page in Workflow Administrator Web Application responsibility is enhanced to test the business event using both PLSQL and Java Raise APIs.

testevent.png

 

Raise in PLSQL

Clicking button "Raise in PLSQL" for a business event results in the PLSQL API WF_EVENT.Raise being used to raise the event. This results in following behavior for different subscription definitions.

  1. Execute PLSQL subscriptions with phase < 100 in the same session
  2. Enqueue PLSQL subscriptions with phase >= 100 to WF_DEFERRED queue
  3. Enqueue ALL Java subscriptions regardless of phase to WF_JAVA_DEFERRED queue

Raise in Java

Clicking button "Raise in Java" for a business event results in the Java method oracle.apps.fnd.wf.BusinessEvent.raise() being used to raise the event. This results in following behavior for different subscription definitions.

  1. Execute JAVA subscriptions (such as WebServiceInvokerSubscription) with phase < 100 in the same session
  2. Enqueue JAVA subscriptions with phase >= 100 to WF_JAVA_DEFERRED queue
  3. Execute PLSQL subscriptions with phase < 100 in the same session
  4. Enqueue PSLQL subscriptions with phase >= 100 to WF_JAVA_DEFERRED queue

Details of different combinations of subscription types and phases and how the subscription is executed based on where it is raised from is discussed in next section.

Verifying Subscription Execution

As long as the call to the Event Raise APIs does not throw an error, the event is raised successfully. There is a wrong notion among developers and administrators that all the events raised are enqueued to an agent (AQ) such as WF_DEFERRED or WF_JAVA_DEFERRED. No, it is not enqueued to an agent always, but it is driven based on how the subscription is defined. Now how are the event subscriptions dispatched and how to check the status of a subscription execution?

Subscriptions are either synchronous (phase < 100) or asynchronous (phase >= 100) with respect to the layer it is raised such as either PLSQL or Java and that layer's ability to dispatch the subscriptions. Following table gives an idea about how different subscriptions are dispatched.

 

 

 

Scenario Event raised in Subscription type Subscription phase Agent (AQ) Dispatched by
1 PLSQL PLSQL >=100 WF_DEFERRED Workflow Deferred Agent Listener
2 PLSQL PLSQL <100 None Same session as WF_EVENT.Raise
3 PLSQL Java Any WF_JAVA_DEFERRED Workflow Java Deferred Agent Listener
4 Java Java >=100 WF_JAVA_DEFERRED Workflow Java Deferred Agent Listener
5 Java Java <100 None Same session as BusinessEvent.raise()
6 Java PLSQL >=100 WF_JAVA_DEFERRED Workflow Java Deferred Agent Listener
7 Java PLSQL <100 None Same session as BusinessEvent.raise()

 

About

This blog is dedicated to bring latest information on Oracle Workflow new features, best practices, troubleshooting techniques and important fixes directly from it's Development Team.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today