Creating custom triggers

The multitiered architecture configuration works by carefully controlling insert, reinsert and update operations in the ObjectServers. The triggers have been intentionally set with a priority of 2 so that any custom insert, reinsert or update operations that are required can be implemented in separate triggers with a priority of 1. This priority setting ensures that the custom triggers are executed first.

Guidelines for creating custom triggers include:
  • Always create a new trigger group for custom triggers; for example, customer_x_triggers.
  • Do not modify the default triggers; create new ones and keep them separate.
    Tip: The main reason for creating separate trigger groups and triggers for custom functionality is to eliminate the risk of overwriting custom functionality. If the default triggers have not been modified, they can be safely replaced with updated versions, as required in future product releases.

Example 1

You want to add a new custom field that you want to update on deduplication. Typical steps that can be performed are as follows:
  1. Add custom fields to all ObjectServers.
  2. Add custom fields to all gateway mapping files.
  3. Create a new trigger group on the collection and aggregation ObjectServers; for example, x_triggers.
  4. Create a new reinsert trigger on the collection and aggregation ObjectServers. Set the priority of the trigger to 1 and assign it to the newly-created trigger group. Update the trigger action to include the lines of code that are needed to update the field. For example:
    set old.MyField = new.MyField;

Example 2

You now want to add a new trigger that performs some custom correlation. Typical steps that can be performed are as follows:
  1. Create a new temporal trigger on both the primary and backup aggregation ObjectServers.
  2. Set the priority of the trigger to 1, choose a suitable prime number timing (for example, 61 seconds) and assign the trigger to the primary_only trigger group to ensure the trigger gets enabled or disabled correctly on the backup ObjectServer.

Triggers that perform correlation should run only on the primary ObjectServer or the backup ObjectServer. Therefore, the new temporal trigger is assigned to the primary_only trigger group because this trigger group is automatically enabled or disabled if the primary aggregation ObjectServer fails or starts up.

Note: When designing any trigger, consider whether it should run concurrently on both the primary and backup aggregation ObjectServers, or whether it should run only on the acting primary aggregation ObjectServer.