Configure relationship change notification
A relationship exists between two managed objects. By default, when a relationship changes (when it is created, updated, or deleted), the managed objects on either side of the relationship are not notified of that change. This means that the state of each object with respect to that relationship field is not recalculated until the object is read. This default behavior improves performance, especially in the case where many objects are affected by a single relationship change.
For roles, a special kind of relationship, change notification is configured by default. The purpose of this default configuration is to notify managed users when any of the relationships that link users, roles, and assignments are manipulated. Learn more about relationship change notification in managed roles in Roles and relationship change notification.
To change the default configuration, or to set up notification for other relationship changes, use the notify* properties in the relationship definition, as described in this section.
A relationship exists between an origin object and a referenced object. These terms reflect which managed object is specified in the URL (for example, managed/user/psmith) and which object is referenced by the relationship (_ref*) properties. Learn more about relationship properties in relationship properties.
In the previous example, a PUT on managed/user/psmith with "manager" : {_ref : "managed/user/bjensen"}, causes managed/user/psmith to be the origin object, and managed/user/bjensen to be the referenced object for that relationship, as shown in the following illustration:
Note that for the reverse relationship (a PUT on managed/user/bjensen with "reports" : [{_ref = "managed/user/psmith"}]) managed/user/bjensen would be the origin object, and managed/user/psmith would be the referenced object.
By default, when a relationship changes, neither the origin object nor the referenced object is notified of the change. So, with the PUT on managed/user/psmith with "manager" : {_ref : "managed/user/bjensen"}, neither the psmith object, nor the bjensen object is notified.
|
Auditing is not tied to relationship change notification and is always triggered when a relationship changes. IDM audits relationship changes, regardless of the |
To configure relationship change notification, set the notify and notifySelf properties in your managed object schema. These properties specify whether objects that reference relationships are notified of a relationship change:
notifySelf-
Notifies the origin object of the relationship change.
In our example, if the
managerdefinition includes"notifySelf" : true, and if the relationship is changed through a URL that referencespsmith, then thepsmithobject would be notified of the change. For example, for a CREATE, UPDATE or DELETE request on thepsmith/manager,psmithwould be notified, but the managed object referenced by this relationship (bjensen) would not be notified.If the relationship were manipulated through a request to
bjensen/reports, thenbjensenwould only be notified if thereportsrelationship specified"notifySelf" : true. notify-
Notifies the referenced object of the relationship change. Set this property on the
resourceCollectionof the relationship property.In our example, assume that the
managerdefinition has aresourceCollectionwith apathofmanaged/user, and that this object specifies"notify" : true. If the relationship changes through a CREATE, UPDATE, or DELETE on the URLpsmith/manager, then the reference object (managed/user/bjensen) would be notified of the change to the relationship. notifyRelationships-
This property controls the propagation of notifications out of a managed object when one of its properties changes through an update or patch, or when that object receives a notification through one of these fields.
The
notifyRelationshipsproperty takes an array of relationships as a value; for example,"notifyRelationships" : ["relationship1", "relationship2"]. The relationships specified here are fields defined on the managed object type (which might itself be a relationship).Notifications are propagated according to the recipient’s
notifyRelationshipsconfiguration. If a managed object type is notified of a change through one if its relationship fields, the notification is done according to the configuration of the recipient object. To illustrate, look at theattributesproperty in the defaultmanaged/assignmentobject:{ "name" : "assignment", "schema" : { ... "properties" : { ... "attributes" : { "description" : "The attributes operated on by this assignment.", "title" : "Assignment Attributes", ... "notifyRelationships" : ["roles"] }, ...This configuration means that if an assignment is updated or patched, and the assignment’s
attributeschange in some way, all therolesconnected to that assignment are notified. Because therolemanaged object has"notifyRelationships" : ["members"]defined on itsassignmentsfield, the notification that originated from the change to the assignment attribute is propagated to the connectedroles, and then out to themembersof those roles.So, the
roleis notified through itsassignmentsfield because anattributein the assignment changed. This notification is propagated out of themembersfield because the role definition has"notifyRelationships" : ["members"]on itsassignmentsfield.
By default, roles, assignments, and members use relationship change notification to ensure that relationship changes are accurately provisioned.
For example, the default user object includes a roles property with notifySelf set to true:
{
"name" : "user",
...
"schema" : {
...
"properties" : {
...
"roles" : {
"description" : "Provisioning Roles",
...
"items" : {
"type" : "relationship",
...
"reverseRelationship" : true,
"reversePropertyName" : "members",
"notifySelf" : true,
...
}
...
In this case, notifySelf indicates the origin or user object. If any changes are made to a relationship referencing a role through a URL that includes a user, the user will be notified of the change. For example, if there is a CREATE on managed/user/psmith/roles which specifies a set of references to existing roles, user psmith will be notified of the change.
Similarly, the role object includes a members property. That property includes the following schema definition:
{
"name" : "role",
...
"schema" : {
...
"properties" : {
...
"members" : {
...
"items" : {
"type" : "relationship",
...
"properties" : {
...
"resourceCollection" : [
{
"notify" : true,
"path" : "managed/user",
"label" : "User",
...
}
]
}
...
Notice the "notify" : true setting on the resourceCollection. This setting indicates that if the relationship is created, updated, or deleted through a URL that references that role, all objects in that resource collection (in this case, managed/user objects) that are identified as members of that role must be notified of the change.
|
Performance and scaling considerations
Relationship change notification happens synchronously, as part of the original request that triggers it. IDM must read and update every notified object before that request completes.
For relationships with a small number of related objects, this has no noticeable effect. However, if a relationship’s notify, notifySelf, or notifyRelationships configuration causes a change to propagate to an extremely large number of objects (for example, tens or hundreds of thousands of members of an organization or role), the propagation can take a long time to complete. This is true regardless of which managed object type is involved. An update to a role with millions of members behaves the same way as an update to an organization with a similarly large membership.
|
Don’t restart IDM during a large-scale relationship change. |
To reduce the performance impact, consider the following:
-
Don’t configure
notifyRelationshipson relationships that can affect large numbers of related objects, and usenotifywith caution. -
Where possible, use a virtual property that is calculated when the object is read (for example, with an
onRetrievescript) rather than a relationship-derived virtual property (RDVP) that recalculates state on every member as soon as the source object changes. -
Propagate changes as a background reconciliation task rather than as part of a synchronous, user-facing request.
-
Test your relationship and notification configuration with data volumes that reflect your production environment, not just the default demo configuration. Load testing at scale is the only reliable way to know whether a given configuration will perform acceptably for your organization or role sizes.
Learn more about additional, hierarchy-specific considerations for organizations in Organizations in high latency environments.