How to reduce ENTITY_CHANGED events on referencing entities when a referenced entity is updated

Question

An entity is referenced by many other entities through a reference attribute. When that entity is updated through the UI or the API, every entity that references it is also updated and generates an ENTITY_CHANGED event. Can these cascading events be prevented?

Answer

Why this happens

A reference attribute shows selected attributes of the referenced entity and of its relation, listed in referencedAttributeURIs. When the referenced entity changes, Reltio refreshes the reference attribute on every referencing entity and sends an ENTITY_CHANGED event for each one to keep them in sync. This is expected behavior. On these events the ovChanged flag is always true.

You can reduce or remove these events with one of the following options.

 

Option 1: Propagate only OV changes (recommended)

Set useOnlyOvValuesInReferencedEntities to true on the referenced entity type in the L3 configuration:

{
  "uri": "configuration/entityTypes/<ReferencedEntityType>",
  "useOnlyOvValuesInReferencedEntities": true
}
  • Reference attributes then contain only the OV (winning) values of the referenced entity. A change to a non-OV value stays on the referenced entity, so no events need to be sent to the referencing entities.
  • OV changes still propagate and still generate ENTITY_CHANGED events on referencing entities.
  • The setting applies to every reference attribute that points to this entity type.
  • Non-OV values can no longer be found by searching through the reference attribute.
  • It implies ignoreNonOVChangesWhenUpdateThroughReferencedEntity, so don't set that option to false.

Test the change in a non-production tenant before applying it to production.

 

Option 2: Filter the events on the streaming destination

If the concern is downstream systems receiving these events, add an objectFilter with a wildcard changes() condition to the streaming destination.

To publish only events where the referencing entity's own attributes changed:

equals(type, 'configuration/entityTypes/<EntityType>') and changes(configuration/entityTypes/<EntityType>/attributes)

To skip events caused by changes to the referenced entity:

equals(type, 'configuration/entityTypes/<EntityType>') and not changes(configuration/entityTypes/<ReferencedEntityType>/attributes)

Keep in mind:

  • changes() works only with the DELTAS or SNAPSHOT_WITH_DELTA payload types.
  • Events without a delta, such as ENTITY_CREATED, are excluded by these filters.
  • If the reference attribute points to its own entity type, both attribute paths are the same, so the filter may not separate the events. In that case, use Option 1 or Option 3.
  • Test the filter against a real event with the Validate object filters API before applying it.

If you can't update the streaming destination yourself, raise a ticket with Reltio Support.

 

Option 3: Use a relation instead of a reference attribute

If the referencing entities don't need to show the referenced entity's values, replace the reference attribute with a plain relation. Updating one entity then doesn't refresh the other. This is a data model change, so first review the data loads, UI, search, exports and integrations that use the reference attribute.

References

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.