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
How To Configure Forward Distribution
- Configure a local importer on the target instances to receive content from the source instance. The configuration object is LocalDistributionPackageImporterFactory
- Configure a “forward” agent on the source instance pointing to the URL of the importer on the target instance. The configuration object is ForwardDistributionAgentFactory.
- 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.
How to Configure Reverse Distribution
- Configure a “queue” agent and package exporter on the source instance i.e., AgentDistributionPackageExporter and the QueueDistributionAgent.
- 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.
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
- Configure a local importer, agent-based exporter, AgentDistributionPackageExporterFactory and a “queue” agent i.e., QueueDistributionAgentFactory on all the publish instances.
- 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.