HomeBackend Development › Custom workflow processes

Custom workflow processes

Purpose: Implement Java process steps for workflows, with payload handling and failure semantics.

Who this page is for

AudienceWhy it matters to you
Backend engineersAutomation inside content processes

A process step

@Component(service = WorkflowProcess.class,
           property = {"process.label=PHI Premium Validation"})
public class PremiumValidationProcess implements WorkflowProcess {
    @Override
    public void execute(WorkItem item, WorkflowSession session, MetaDataMap args)
            throws WorkflowException {
        String path = item.getWorkflowData().getPayload().toString();
        // resolve payload with a service-user resolver, validate premium fields
        // throw WorkflowException to fail the step (instance shows failure)
    }
}

The process.label is what workflow model editors pick in the UI. args carries the PROCESS_ARGS configured on the step — parameterise, don't hardcode.

Payload discipline

RuleWhy
Treat payload as a path, verify it exists and is the expected typeSteps run on assets, pages, anything
Use a service-user session, not the workflow session's admin-ish powers, for external effectsLeast privilege, auditability
Keep steps small and composableModels are easier to reason about as pipelines of small steps
Store step outputs in workflow metadata, not on the content, unless the content is the pointAvoids polluting pages with transient state

Failure & retry semantics

Quick navigation