Building Processes
Create business logic with qqq processes
Overview
Processes in qqq encapsulate business logic as reusable, configurable workflows. They can be triggered manually, via API, or on schedule.
Process Structure
A process consists of steps that execute sequentially:
Java
@QProcessMetaData(name = "approveOrder")
public class ApproveOrderProcess implements ProcessMetaDataProducer {
@Override
public QProcessMetaData produce(QInstance qInstance) {
return new QProcessMetaData()
.withName("approveOrder")
.withLabel("Approve Order")
.withTableName("order")
.withSteps(List.of(
new QBackendStepMetaData()
.withName("validate")
.withCode(new ValidateOrderStep()),
new QBackendStepMetaData()
.withName("approve")
.withCode(new ApproveOrderStep())
));
}
}Step Types
Input and Output
Processes accept input fields and produce output:
Java
.withInputFields(List.of(
new QFieldMetaData("orderId", QFieldType.INTEGER)
.withIsRequired(true)
))
.withOutputFields(List.of(
new QFieldMetaData("approvalStatus", QFieldType.STRING)
))Scheduling
Run processes on a schedule:
Java
.withSchedule(new QScheduleMetaData()
.withCronExpression("0 0 * * *")
.withDescription("Daily at midnight"))Error Handling
Processes support retry and error handling configuration.