Purging workflow after couple minutes



I have a Workflow step which if meet issues throw `WorkflowException` with a message and stacktrace, in effect - blocks whole workflow launcher with the payload. Finally, the workflow is indefinitely in the `RUNNING` state and does not handle any updates for blocked payload. This situation requires admin action to manually terminate the workflow.

There is how the simple workflow looks:


        (name = Constants.SERVICE_DESCRIPTION, value = "Workflow"),
        (name = "process.label", value = "Workflow Step") })
public class WorkflowStep implements WorkflowProcess {
    public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metaDataMap)throws WorkflowException {       
        try {
            ... doing some stuff ...
        } catch (Exception e) {
            throw new WorkflowException(e.getMessage(), e);



I want to check after i.e 2 minutes if the workflow is `COMPLETED` if not - terminate them to unblock the payload and after upload the next asset into this path - again handle by the workflow.

Any idea how to solve it without using `CRON Scheduler`?

AEM workflow

Accepted Solutions (0)

Answers (0)