Building Processes
Implement backend steps and register their code references in process metadata.
Implement a backend step
A BackendStep receives both input and output and returns void. Place this complete class in HelloStep.java:
import com.kingsrook.qqq.backend.core.actions.processes.BackendStep;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepInput;
import com.kingsrook.qqq.backend.core.model.actions.processes.RunBackendStepOutput;
public class HelloStep implements BackendStep
{
@Override
public void run(RunBackendStepInput input, RunBackendStepOutput output)
{
output.addValue("message", "Hello from QQQ");
}
}Register the process
Use a QCodeReference to the step class. This fragment belongs in your metadata producer; HelloStep must be in scope.
import java.util.List;
import com.kingsrook.qqq.backend.core.model.metadata.code.QCodeReference;
import com.kingsrook.qqq.backend.core.model.metadata.processes.QBackendStepMetaData;
import com.kingsrook.qqq.backend.core.model.metadata.processes.QProcessMetaData;
QProcessMetaData hello = new QProcessMetaData()
.withName("hello")
.withLabel("Hello")
.withStepList(List.of(new QBackendStepMetaData()
.withName("greet")
.withCode(new QCodeReference(HelloStep.class))));Add the process to your instance. Declare input/output field metadata for values exposed to a frontend step. The sample Greet Interactive process demonstrates input collection, backend execution, and a result screen.
Scheduling and failures
Scheduling is configured through QScheduleMetaData and the application's scheduler lifecycle. Quartz cron syntax is not a five-field Unix cron expression. Select the intended time zone and test the next fire times. Make retries and side effects explicit in your application; process metadata alone does not guarantee safe retry of an external operation.
See the process reference and scheduled jobs.