Saturday, February 17, 2018

Approach to implement content preview environment in Adobe Experience Manager(AEM)

Approach to implement content preview environment in Adobe Experience Manager(AEM)


By default Adobe Experience Manager(AEM) not provides the preview instance to preview the content before publishing to live environment but most of the cases preview is required before publishing the content to live environment.

This post explain the approach to preview and approve the content before publishing to live environment.

The below diagram explains the preview flow

AEM_Preview_environment


  • Author creates the content in production author and start the workflow
  • Workflow sends the content to Stage author and Publishers
  • Workflow assign the task to approver group and send the notification email
  • Approver reviews the content in stage environment and approve or reject the content (workflow)t - provides the detailed information for rejection
  • if the content is approved 
    • Workflow sends the approved content to production publishers.
  • If the content is rejected
    • Workflow assign the task to author and sends the notification
    • Author review the details and completes the workflow
    • Start the process again by correcting the content

Define Replication process step with ECMA script:


Create ecma file replicate.ecma under /etc/workflow/scripts/<<application>>  e.g. /etc/workflow/scripts/blog - This ecma script helps to replicate the content to stage environments


var workflowData = workItem.getWorkflowData();
var path = workflowData.getPayload().toString();
var session = workflowSession.getSession();

var replicator = sling.getService(Packages.com.day.cq.replication.Replicator);
var options = new Packages.com.day.cq.replication.ReplicationOptions();

for(var i=0;i<args.length;i++) {
    var agent= args[i];
    var filter = new Packages.com.day.cq.replication.AgentIdFilter(agent);
    options.setFilter(filter);
    options.setSuppressStatusUpdate(true);
    try {
        replicator.replicate(session, Packages.com.day.cq.replication.ReplicationActionType.ACTIVATE, path, options);
} catch(e) {
    log.error("Cannot replicate page : " + path +"on publisher. (agentId: " + agent + "): " + e);
}
}

AEM_preview_environment_approver

Define approver group:


Create a user group in production author- workflow-approver and add the required users to the group

AEM_preview_environment_approver_group


AEM_preview_environment_approver_group

Define Replication agents:


Define replication agents for Staging author and staging publishers in production author, Check only the checkbox associated with "ignore default" 

AEM_preview_environment_agent

Define workflow model:


Create new workflow model in production author- Content Review

AEM_preview_environment_workflow

Add a process step, select the ecma script defined in the previous step - /etc/workflow/scripts/blog/remlication.ecma as process
Select Handler Advance
Provide the staging replication agents as the argument - e.g. stage-author,stage-publisher1,stage-publisher2

AEM_preview_environment_workflow

Add a Participation Step and select the approver group defined
Select checkbox associated with Email

AEM_preview_environment_workflow

Add OR split with two branches
Add Activate Page/Asset step in the first branch

AEM_preview_environment_workflow

Add Dynamic Participant Step in the second branch and select Workflow Initiator Participant Chooser (Script)
Select checkbox associated with Email

AEM_preview_environment_workflow


Save the final workflow

AEM_preview_environment_workflow


Create the content and initiate the workflow for the content path in production author- Content Author

AEM_preview_environment_workflow

AEM_preview_environment_workflow

The content is published to stage author and publisher.
The workflow item is assigned to the workflow-approver group and email is send to the group.

AEM_preview_environment_workflow

Login to workflow inbox(production) with the user id who is part of workflow-approver group
Approve or Reject the content - Select the corresponding Next Step  "Activate Page/Asset" or "Reject workflow step"

AEM_preview_environment_workflow


AEM_preview_environment_workflow

If the content is approved, the approved  content is activated/published to production publisher(via default publisher agents)
If the content is rejected, the workflow item is assigned to the workflow initiator(author) and email is send.

AEM_preview_environment_workflow

Login to workflow inbox(production) with the author user id, complete the workflow. Correct the content based on the comment provided by approver and restart the process.

AEM_preview_environment_workflow



1 comment:

  1. Hi Albin,

    I am regular reader of your blog and its absolutely helpful. I am trying to implement a content release strategy based on this article. Can you help me by answering few queries
    1. Do we need a staging author and publisher ? I see that we have to log in to preview server as well. Can we make it as a publisher only environment which requires a login.
    2. In this case, workflow is running in author -> which makes the page to go to staging -> On approve/reject, how the status is transferred from staging server to author server back.
    3. Does this mean, the workflow instance will hang in until the page is approved or rejected. Will this cause any harm or is there any suggestion to auto kill with a timer etc.
    4. The page status will show a weird status since the page is activate, it will show as activated/green. But, in reality, its still waiting in staging .
    5. How page deactivations can be handled. Any suggestions for that.
    6. We use aws snapshots as a means of lower environments(which don't have preview server). If there are hanging workflow instance and pages are stuck between author and publisher

    Can you please check and let me know what you think about the questions. Thanks in advance.

    ReplyDelete