The term “distribution”, when referring to distributing content, means the ability to select one or more resources in a particular Sling instance and copy and persist them to another Sling instance. Sling content distribution (SCD) is an open source framework for distributing resources between Sling instances, maintained as part of the Apache Sling project.
Adobe Experience Manager (AEM) as a Cloud Service has changed the way content is published. AEM as a Cloud Service no longer uses the replication framework from previous versions of AEM to publish content. AEM as a Cloud Service uses the Sling Content Distribution feature to move the right content. AEM as a Cloud Service uses pipeline services that run on Adobe I/O outside of the AEM runtime.
Sling Content Distribution configuration is backed by OSGi configuration. Each SCD OSGi configuration instantiates a distribution component in the background. Critical SCD components include distribution agents, exporters, importers, and secret providers. The API works at the path level and the Distribution Agent enables distribution of specific paths between instances. The purpose of SCD is to be reliable, simple, and extensible.
The Sling Content Distribution Module can distribute content in the following ways:
- Forward distribution: “push” the content to the target instance
- Reverse distribution: “Pull” content from remote source instances
- Synchronous distribution: “Synchronize”, i.e. synchronize content across multiple instances with the coordinating instance
How to set up forward distribution
- Configure a local importer on the target instance to receive content from the source instance.The configuration object is LocalDistributionPackageImporterFactory
- Configure a “forwarding” agent on the source instance that points to the URL of the importer on the target instance. The configuration object is ForwardDistributionAgentFactory.
- Forward distribution can also be used for proxy activation. Replication proxies to the author’s forward Distribution Agent. A way to do this is to use Distribution as the serialization type and use it in the transport URI distribution://{agentName}. So when content is published, it will be replicated to the publishing instance. Note: This applies when setting up replication agents on AEM versions 6.5 and earlier.
How to set up reverse distribution
- Configure a “queue” agent and a package exporter on the source instance. That is, AgentDistributionPackageExporter and QueueDistributionAgent.
- Configure a “reverse” agent on the target instance. In other words, the ReverseDistributionAgentFactory points to the exporter’s URL on the source instance. You can configure multiple publisher endpoints.
Sling distribution only sends change data to the publish instance, not the originator. Configuring synchronous distribution is more complicated than other distribution types. The author instance acts as a coordinator instance and helps distribute content to all target/publisher instances.
How to configure synchronous distribution
- Configure a local importer, an agent-based exporter, an AgentDistributionPackageExporterFactory, and a “queue” agent, or QueueDistributionAgentFactory, on every publish instance.
- Configure the sync distribution agent on the author/coordinator instance, i.e. the SyncDistributionAgentFactory, and configure the endpoints to the URLs of all target instances.
delivery trigger
Distribution triggers can be configured to automate the distribution of content between source and target instances.
- DistributionEventDistributeDistributionTrigger — for chain distribution on specific distribution event topics
- JcrEventDistributionTrigger — JCR watch-based triggers trigger distribution based on JCR events on specific nodes. Configure a JCR event trigger on the author to add JCR changes under the configured path to the transfer agent queue.
- RemoteEventDistributionTrigger — Trigger distribution upon receipt of an event sent by the server at a specific URL
- ResourceEventDistributionTrigger — to trigger a specific trigger when a node/property changes under a specific path
- ScheduledDistributionTrigger – To schedule distributions on specific distribution agents, trigger distributions based on specific intervals.
- “Apache Sling Distribution Triggers” — “Scheduled Triggers Factory” can be configured to deliver content on a regular basis
The Importance of Sling Content Delivery
With the move to AEM as a Cloud Service, the traditional method of publishing content has moved away from replication agents and towards content delivery using Sling. Therefore, learning about the core architecture of SCD is helpful in understanding this replication framework. In addition, there are specific configurations that are not covered in this article, such as the retry strategy and his SCD’s priority queue.You can find more information about this here.