About Object Subscription
The Object Subscription is a change data capturing mechanism which makes it possible for users to subscribe to items/objects such as Customer Orders, Purchase Orders, Purchase Requisitions so they get notified when a change occurs to a subscribed object. The Object Subscription functionality can create Stream notifications and E-Mails to users who have subscribed to the changed objects.
How it works
The Object Subscription functionality uses Database Triggers, Oracle Advanced Queuing and Oracle Scheduler processes as its key components. The following illustration shows how the Object Subscription functionality works. How the Streams functionality works is discussed here.
AQ = Advanced Queue
When a user subscribes to any row/object in a logical unit, a trigger is created (if not already created) on the base table of the logical unit. Only two triggers are created per logical unit no matter the number of users or objects subscribed in it. One trigger to capture when rows are updated identified by <LU_NAME>_TRK_Uand another to to capture deleted rows identified by <LU_NAME>_TRK_D .Subscription can be for one field, multiple field or for all subscribable fields.
When a change is done to the data in the table, the relevant trigger is fired. The code inside the trigger serializes the changes occurred in table columns and then posts an Oracle Advanced Queuing Message to the Oracle Advanced Queue FND_TRK_LU_DMO_Q. At this point the trigger finishes execution and returns. The next steps are performed asynchronously in the background as follows.
A PL/SQL procedure (Fnd_Trk_Dmo_Callback) is registered as a subscriber to this queue and when a message is queued Oracle internally runs scheduler jobs that would call this procedure. It would in turn call Fnd_Obj_Tracking_SYS.Tracking_Queue_Callback which then calls Fnd_Obj_Subscription_Util_API.Process_Request_ which does all subscription related processing. Then using subscription information, Stream messages and E-Mails are created to the users who have subscribed to the particular change. The Streams functionality also has a push notification services which informs connected clients if relevant streams are available.
Subscribable Logical Units and Fields
Not all logical units and fields are available for subscription. Given below are the requirements for a logical unit and its fields to be subscribable.
- Logical Unit must have a base table.
- Objkey/Rowkey and OBJID must be available and enabled on the logical unit.
- Field must be available in both the base table and the view currently used in the client form. Both the view and the table must be of the same logical unit. (e.g. client side derived attributes are not supported)
- Field must have valid properties
- Data type must be NUMBER, DATE or VARCHAR2. CLOB columns are not currently supported.
There are three ways you can subscribe to an object.
- Subscribe on only one field
- Subscribe any field change - This means any subscribable field, may not mean all visible fields. Any new field added to logical unit after the subscription was done will not be automatically added to the subscription.
- Subscribe to multiple fields. Here the user can select any number of subscribable fields to subscribe to. Also the user can set conditions to each of the selected fields so that any change to that field will be checked against that condition and only if its fulfilled, a notification will be generated,
When an subscribed object is deleted/removed, a stream notification (and email) will be sent to all users who have subscribed to the object in any way.
When an Object which is subscribed upon is changed it the Object Subscription functionality creates a Streams Message. This message includes the following details
The header of the Streams message will show Form window header where the Object was subscribed from. Clicking on the header will navigate to the relevant form.
The message body is created as a IFS Message. This is then translated according to the user's logged on language. The Streams notification is displayed in the Streams Panel and the Notification window inside My Administration. If translations are not available the information will be shown in the default database server language used when the Streams message was created.
Currency, Date, Date/Time, Time, Number fields are formatted according to the current logged on user settings and locale.
Note: The actual value(s) which were changed in a field will be shown only if the value length is less than 200 characters. If the changes to the object are large then the message will only state that the object was changed.
When subscribing to an object it is also possible to request an E-Mail about the changes to the object. The E-Mail Subject will show the Form window header where the Object was subscribed from. The E-Mail body will include the fields which were changed. The E-Mail will be translated in the user's preferred language.