Expand my Community achievements bar.

Unexpected Multiple Invocations of PackageContentBuilder.create() on Deactivate Replication

Avatar

Level 2

I am encountering an unexpected behavior in AEM during the Page Publish workflow rollback scenario.

When a parent page is activated (using Replicator.replicate) using a custom replication agent, the replication framework correctly triggers one invocation of PackageContentBuilder.create(which is an implementation of ContentBuilder class, and is configured through serializationType in the agent) for the parent payload.
However, when the same parent page is deactivated (as part of rollback), the replication framework triggers multiple implicit invocations of PackageContentBuilder.create() — first for the parent, then for each of its child pages.
This occurs even though only the parent path is explicitly passed to the Replicator.replicate() call.

 

Raised adobe ticket and they confirmed that this is the OOTB functionality and we want to implement  a custom replication deactivation flow. Can anyone please suggest  how to  implement that.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 2

Hi @kaniar

To implement the custom deactivation flow write the service/workflow step that accept only the parent path or filter the child pages. Use the below code the deactivate the content. 

replicator.replicate(session, ReplicationActionType.DEACTIVATE, "/content/site/page", options);

 make sure options includes the custom replication agents or serialization type if any


Avatar

Level 10

hi @kaniar, I think you may find this article useful: https://unlocklearning.in/replication-via-a-selected-replication-agent/ 

Avatar

Level 5

Hi @kaniar,

This behavior is expected OOTB during deactivation, AEM automatically processes the parent and all its child pages individually, which is why PackageContentBuilder.create() is called multiple times.

To implement a custom deactivation flow, you can- Create a custom workflow or service that handles deactivation manually.
Inside it, use the Replicator API but customize logic to replicate only the specific path (the parent) without recursively deactivating children.
Optionally, register a custom replication action or extend DefaultReplicationContentFactory to control which nodes are included.

OOTB deactivation replicates all descendants. To avoid that, build a custom replication or workflow step that explicitly deactivates only the parent path.