ÃÛ¶¹ÊÓƵ

Sample configuration of workflow purge task for AEM as a Cloud Service

This article explains a sample configuration for setting up workflow purge as a maintenance task in AEM as a Cloud Service.

Description description

Environment

ÃÛ¶¹ÊÓƵ Experience Manager as a Cloud Service (AEMaaCS)

Issue/Symptoms

This article is a sample configuration for setting up workflow purge as a maintenance task in AEM as a Cloud Service.

Reference:
ÃÛ¶¹ÊÓƵ Experience Manager Maintenance Guide

Resolution resolution

To set up a workflow purge as a maintenance task, follow these steps to configure the necessary elements in your Maven project:

Step1. OSGi configuration

Create an OSGi configuration file.

Path: ui.config/src/main/content/jcr_root/apps/>project_name</osgiconfig/config.author/ com.adobe.granite.workflow.purge.Scheduler >project_name<.cfg.json

Example configuration:

{
  "scheduledpurge.workflowStatus": "COMPLETED",
  "scheduledpurge.name": "Workflow Purge",
  "scheduledpurge.daysold": 30,
  "scheduledpurge.modelIds": [ ] ,
  "scheduledpurge.purgePackagePayload":true
}

This configuration is to delete workflow instances that were completed more than 30 days ago.

Step2. Configure the maintenance window

  1. Create a weekly maintenance window node. Path: ui.apps/src/main/content/jcr_root/apps/settings/granite/operations/maintenance/granite_weekly/.content.xml
    Example configuration:

    code language-none
    <?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:Folder"
       sling:configCollectionInherit="true"
       sling:configPropertyInherit="true"
       windowEndTime="15:30"
       windowSchedule="weekly"
       windowScheduleWeekdays="[ 5,5] "
       windowStartTime="14:30"/>
    

    This configuration runs the maintenance task every Thursday from 14:30 to 15:30 (UTC).

  2. Create the workflow purge task node. Path: ui.apps/src/main/content/jcr_root/apps/settings/granite/operations/maintenance/granite_weekly/granite_WorkflowPurgeTask/.content.xml
    Example configuration:

    code language-none
    <?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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
      jcr:primaryType="nt:unstructured"
      sling:resourceType="granite/operations/components/maintenance/task"
      granite.maintenance.name="WorkflowPurgeTask"
      granite.task.hint="HINT: Please add workflow models to be deleted to the workflow-purge configuration, which is available under ÃÛ¶¹ÊÓƵ Granite Workflow Purge Configuration under Web Console Configuration-Manager."/>
    
  3. Configure a package filter for node installation. Path: ui.apps/src/main/content/META-INF/vault/filter.xml
    Example configuration:

    code language-none
    <workspaceFilter version="1.0">
      ...
    <!-- Add the below line to existing settings -->
    <filter root="/apps/settings/granite/operations/maintenance/granite_weekly"/>
    </workspaceFilter>>
    
  4. Update the filevault-package-maven-plugin filter: Path: ui.apps.structure/pom.xml
    Example configuration:

    code language-none
    <plugin>
        <artifactId>filevault-package-maven-plugin</artifactId>
            <configuration>
                <filters>
                          ...
                    <!-- Add the below lines to existing settings -->
                    <filter><root>/apps/settings/granite</root></filter>
                    <filter><root>/apps/settings/granite/operations</root></filter>
                    <filter><root>/apps/settings/granite/operations/maintenance</root></filter>
                    <filter><root>/apps/settings/granite/operations/maintenance/granite_weekly</root></filter>
                </filters>
            </configuration>
    </plugin>
    

Step3. Local testing

Build and install the configuration to the local SDK. Verify the result of the workflow purge task.

$ mvn clean install -PautoInstallSinglePackage

Step4. Cloud deployment

Once validated, commit and push the configuration to the Git repository. Run the Cloud Manager pipeline to deploy it to your AEM as a Cloud Service environment. Make sure to deploy the configuration from the lower environments.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f