Issue regarding SlingRequestProcessor in AEM as a Cloud Service not support?

303 Views Asked by At

In our project there is a requirement, when ever we will click on rollout on parent page it will trigger one workflow and once approver approves the workflow, it will update live copy(locale) automatically or programmatically.

To achieve this we are using below code (adding [1],[2],[3],[4] in code)

@Override
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {

   try {
      ResourceResolverTemplate.execute(DAM_SERVICE, resolver -> {
      if (workItem.getWorkflowData().getMetaDataMap().get("rollout_status").toString().equals("approved")) {

         WorkflowData workflowData = workItem.getWorkflowData();
         Map<String, Object> params = new HashMap<>();
         for (Entry<String, Object> entry : workflowData.getMetaDataMap().entrySet()) {
            if (entry.getKey().contains("-")) {
               // replacing '-' with ':' for properties having colon eg msm:targetPath,
               // msm:async.
               params.put(entry.getKey().replaceFirst("-", ":"), entry.getValue());
            } else {
               params.put(entry.getKey(), entry.getValue());
            }
         }

         [1]HttpServletRequest req = requestResponseFactory.createRequest("POST", "/bin/wcmcommand", params);
         [2]ByteArrayOutputStream out = new ByteArrayOutputStream();
         [3]HttpServletResponse response = requestResponseFactory.createResponse(out);
         [4]requestProcessor.processRequest(req, response, resolver); 
         //rollout
       }
    });
   } catch (Exception e) {
      log.error("Dentsply rollout process step exception: {}", e.getMessage());
   }
}

I am able to get req[1] and response[3] but in last step [4] requestprocessor.processRequest it is breaking.

Same functionality is working fine in our on-prem environment but in cloud it is breaking.

So my ask here is SlingRequestProcessor supports in AEM cloud? Because I have checked in debug mode once code came in below step and tried to execute processRequest() nothing is happening.

I am not able to rollout the page programmatically using processRequest() method, do we have any other option?

0

There are 0 best solutions below