Wednesday, November 25, 2020

AEM Sling Pipes Examples: Manifold [Parallel Execution]

 Sling Pipes Examples for Manifold

Container Pipes have limitation that the sequential sub-pipes are skipped on very first encounter of a void pipe.

Void pipe may be some pipe that didn't produce any output may be due to action input was not valid ie lets say a base path accessing a property will be null in case the property is not available in this case such ppe will be a void pipe and prevent any subsequent pipe defined.

Manifold helps solve above issue if despite the fact the first pipe set worked or not we want rest to work kind of parallel execution.

As per sling documentation:
"Container pipe chains sub pipes and will stop when any subpipe produces no output, the manifold pipe handles subpipes as independent streams and combines their output regardless of any void subpipe output"

Manifold aids in having parallel execution that too with further flexibility on control of parallel threads to execute sub pipes.

In case all sub pipes are manipulating properties in same metadata node, to avoid any exception we would like to have single thread operation to guarantee execution of all valid pipes.

Documentation states property name as 'numThread' however its 'numThreads' which is used to control this. default thread count is 5.

As per sling documentation:
numThread thread pool size for the execution of the subpipes, default is 5 - resource output will be ordered randomly; setting it to 1 will guarantee serial execution with predictable output order (i.e. the first subpipe resources will be exhausted before the second subpipe resources are output etc.); setting numThreads to 1 will have similar effects to using a container pipe, with the notable exception of output termination

Thursday, November 29, 2018

Setup Versioned Clientlibs on AEM

This is a "How to" guide to setup Versioned ClientLibs for your project.

Step 1 : Introduce ACS commons as dependency / sub package of you project if not already.



Step 2 : Configurations



Please note you may have to restart your AEM server if rewriter configurations do not reflect in sling-rewriter interface or are ineffective (hash code not appending in clienlib urls) right after you copy and modify them under project folder from libs.

Step 2.1 : Configuring logger to prevent warning /info messages from versioned clientlib:

Create an xml named like : 
org.apache.sling.commons.log.LogManager.factory.config-versionedClientlibs
under config folder itself (one used to put rewriter configs as per document guide pointed above).

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
    xmlns:jcr="http://www.jcp.org/jcr/1.0" jcr:primaryType="sling:OsgiConfig"
    org.apache.sling.commons.log.file="logs/error.log"
    org.apache.sling.commons.log.level="error"
    org.apache.sling.commons.log.names="[com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl]"
    org.apache.sling.commons.log.pattern="\{0,date,yyyy-MM-dd HH:mm:ss.SSS} {4} [{3}] {5}" />