Unexpected Multiple Invocations of PackageContentBuilder.create() on Deactivate Replication | Community
Skip to main content
Level 2
November 10, 2025
Question

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

  • November 10, 2025
  • 3 replies
  • 226 views

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.

3 replies

Level 2
November 10, 2025

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


giuseppebaglio
Level 10
November 11, 2025

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

VishalKa5
Level 5
November 13, 2025

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.