Tuesday, March 31, 2015

Avoid unnecessary AEM workflows

Avoid using workflows to handle basic operations by using a a Sling Post Processor. Workflows can be an unneeded burden because launchers can be painful to configure and too many workflows running can causes performance issues.

 import java.util.List;  
 import org.apache.felix.scr.annotations.Component;  
 import org.apache.felix.scr.annotations.Service;  
 import org.apache.sling.api.SlingHttpServletRequest;  
 import org.apache.sling.servlets.post.Modification;  
 import org.apache.sling.servlets.post.SlingPostProcessor;  
 @Component(metatype = false, immediate = true)  
 @Service  
 public class SamplePostProcessor implements SlingPostProcessor {  
      @Override  
      public void process(SlingHttpServletRequest request, List<Modification> modificationList) throws Exception {  
           // POST servlet had already made its changes but the session hasn't been commited yet  
      }  
 }  

No comments:

Post a Comment