Friday, May 22, 2020

SLING CONTENT DISTRIBUTION - SYNC USER AND CONTENT ON AEM AUTHOR AND PUBLISHERS (PART1)


SLING CONTENT DISTRIBUTION - SYNC USER AND CONTENT ON AEM AUTHOR AND PUBLISHERS (PART1) 


SLING CONTENT DISTRIBUTION:

  • allowing distribution of content among different Sling instances.
  • "distribution" - the ability of picking one or more resources on a certain Sling instance in order to copy and persist them onto another Sling instance. 
  • The Sling Content Distribution module is able to distribute content by:
"pushing" from Sling instance A to Sling instance B - Forward distribution
"pulling" from Sling instance B to Sling instance A - Reverse distribution
"synchronizing" Sling instances A and B via a (third) coordinating instance - Sync distribution
  • Agent - creating one or more packages of resources from the source(s), dispatching such packages to one or more queues and of processing such queued packages by persisting them into the target instance(s)
  • exporting - process of creating one or more packages, operation may either happen locally to the agent (the "push" scenario) or remotely (the "pull" scenario).
  • importing  - process of persisting one or more packages, operation may either happen locally (the "pull" scenario) or remotely (the "push" scenario). 

 

SLING CONTENT DISTRIBUTION - TRIGGERS

  • Forward distribution - Create/update content
curl -v -u admin:admin http://localhost:4502/libs/sling/distribution/services/agents/publish -d “action=ADD” -d “path=/content/sample1”
  • Forward distribution - Delete content
curl -v -u admin:admin http://localhost:4502/libs/sling/distribution/services/agents/publish -d “action= DELETE” -d “path=/content/sample1”
  • Reverse distribution - Create/update content
curl -u admin:admin http://localhost:4503/libs/sling/distribution/services/agents/reverse -d “action=ADD” -d “path=/content/sample1”
curl -u admin:admin http://localhost:4502/libs/sling/distribution/services/agents/publish-reverse -d “action=PULL”
  • Sync Distribution
curl -u admin:admin http://localhost:4503/libs/sling/distribution/services/agents/reverse-pubsync -d 'action=ADD' -d 'path=/content/sample1’ 
curl -u admin:admin http://localhost:4502/libs/sling/distribution/services/agents/pubsync -d 'action=PULL'

Trigger Factories to trigger the distribution on specific agent based on the events.
  • DistributionEventDistributeDistributionTrigger - DistributionTrigger for chain distribution upon a certain DistributionEventTopics
  • JcrEventDistributionTrigger - A JCR observation based DistributionTrigger.
  • PersistedJcrEventDistributionTrigger - DistributionTrigger that listens for certain events and persists them under a specific path in the repo
  • RemoteEventDistributionTrigger - DistributionTrigger to trigger distribution upon reception of server sent events on a certain URL
  • ResourceEventDistributionTrigger - DistributionTrigger for triggering a specific handler (e.g. agent) upon node / properties being changed under a certain path
  • ScheduledDistributionTrigger - DistributionTrigger to schedule distributions on a certain DistributionAgent


FORWARD DISTRIBUTION - DEFINITION

  • A forward distribution setup allows one to transfer content from a source instance(Author) to a farm of target instances(Publish)
  • That is done by pushing the content from source to target
sling-forward-distribution-aem


FORWARD DISTRIBUTION - CONFIGURATION

  • configure a local importer on publish
org.apache.sling.distribution.packaging.impl.importer.LocalDistributionPackageImporterFactory
name=“default”
  • configure a "forward" agent on author pointing to the URL of the importer on publish
org.apache.sling.distribution.agent.impl.ForwardDistributionAgentFactory
packageImporter.endpoints=[“endpoint0=http://127.0.0.1:4503/libs/sling/distribution/services/importers/default”]
 

sling-forward-distribution-configuration-aem.png

 

FORWARD DISTRIBUTION - DEMO

  • Configure Forward Agent in Author – UI/OSGI Config
  • Configure Local Importer in Publisher
  • Enable Triggers – Scheduled/JCREvent
  • Test – CURL/UI/Triggers
 


No comments:

Post a Comment