Adobe Experience Manager Distribution‑Based Publication

September 15, 2022
Adobe Experience Manager Distribution-Based Publication

The term "distribution", when referring to content distribution, means the ability of picking one or more resources on a certain Sling instance to copy and persist them onto another Sling instance. Sling content distribution (SCD) is an open-source framework for distributing resources between Sling instances andis maintained as part of the Apache Sling project.


Adobe Experience Manager (AEM) as a Cloud Service has modified the way publishing content works. With AEM as a Cloud Service, the replication framework from previous versions of AEM is no longer used to publish content. AEM as a Cloud Service uses the Sling Content Distribution capability to move the appropriate content. AEM as a Cloud Service uses a pipeline service run on Adobe I/O, which is outside the AEM runtime.

Sling Content Distribution configurations are backed by OSGi configurations. Each SCD OSGi configuration will instantiate a distribution component in the background. Some of the important SCD components are a Distribution Agent, Exporters, Importer, Secret Provider etc. The API works at path level and the distribution agents enable distribution of specific paths between instances. The aim of SCD is to be reliable, simple, and extensible.


The Sling Content Distribution module can distribute content by:

  • Forward Distribution: "pushing" the content to target instances
  • Reverse Distribution: "pulling" content from the remote source instances
  • Sync Distribution: "synchronizing" i.e., synchronize content across multiple instances with a coordinating instance
image 1

Forward Distribution

A forward distribution setup allows one to transfer content from a source instance (Author) to a farm of target instances (Publish). It is done by pushing the content from source to target. Configuring forward distribution is quite simple and requires some information about the target instances. It can be enabled by adding a couple of OSGi configurations on the source instance and on the target instances.

How To Configure Forward Distribution
  1. Configure a local importer on the target instances to receive content from the source instance. The configuration object is LocalDistributionPackageImporterFactory
  2. Configure a “forward” agent on the source instance pointing to the URL of the importer on the target instance. The configuration object is ForwardDistributionAgentFactory. 
  3. Forward distribution can also be used for proxy activations. The replication proxies to the author's Forward distribution agent. The way we can do that is, we can use Distribution as the serialization type and in the transport Uri distribution://{agentName}. So, when the content is published, it’s replicated to publish instances. Note: This is applicable when setting up the replication agent on AEM version 6.5 or lower.

image 2

image 3

image 4

image 6

Reverse Distribution

A reverse distribution setup allows one to transfer content from one or more source instances (publisher) to a target instance (author). It is done by pulling the content from source instances into the target instance. Configuring reverse distribution is like the steps taken for forward distribution. It’s enabled by adding OSGi configurations on the target instance and the source instances.

How to Configure Reverse Distribution
  1. Configure a “queue” agent and package exporter on the source instance i.e., AgentDistributionPackageExporter and the QueueDistributionAgent. 
  2. Configure a “reverse” agent on target instance i.e., ReverseDistributionAgentFactory pointing to the URL of the exporter on source instance, multiple publisher endpoints can be configured.

image 6

image 7

Sync Distribution

Sync distribution allows modifications made on one publish instance to be synchronized across the publish farm via the author instance. The modifications are automatically synchronized across the publish instances in the farm and are not created on the author. This is done by the author pulling the content from source instance (publish) and distributing it to the other publish instances on the farm. 

Sling distribution only sends the modification data to non-originating publish instances. Configuring sync distribution is more complicated than the other distribution types. The author instance acts as the coordinator instance and helps distribute content across all the target/publisher instances.

How to Configure Sync Distribution
  1. Configure a local importer, agent-based exporter, AgentDistributionPackageExporterFactory and a “queue” agent i.e., QueueDistributionAgentFactory on all the publish instances. 
  2. Configure a Sync distribution agent on the author/coordinator instance i.e., SyncDistributionAgentFactory and configure the endpoints to the URLs of all the target instances.

Distribution Triggers

The Distribution triggers can be configured to automate the distribution of content between the source and target instances.

  • DistributionEventDistributeDistributionTrigger — for chain distribution upon a certain Distribution Event Topics
  • JcrEventDistributionTrigger — A JCR observation-based trigger, triggers the distribution based on JCR events on specific nodes. Configure a JCR Event Trigger in Author to add the JCR changes under the configured path to the Forward Agent Queue.
  • RemoteEventDistributionTrigger —to trigger distribution upon reception of server-sent events on a certain URL
  • ResourceEventDistributionTrigger —for triggering a specific trigger upon node/properties being changed under a certain path
  • ScheduledDistributionTrigger - to schedule distributions on a certain Distribution Agent, trigger the distribution based on a specific interval. 
  • The “Apache Sling Distribution Trigger — Scheduled Triggers Factory” can be configured to distribute the content on a regular interval

The Importance of Sling Content Distribution 

As we’re moving towards AEM as a Cloud Service, the traditional way of publishing content is moving away from Replication agents and gearing towards Content Distribution using Sling. So, learning about the core architecture of SCD is helpful in understanding this replication framework. Further, there are certain configurations which are not discussed in this post, like retry strategy and priority queue for SCD.  More information on this can be found here.