Getting started
This page shows the shortest path to run a Quarkus Flow workflow inside your Quarkus app, with Quarkus-native ergonomics (CDI, build-time discovery, dev mode).
1) Add the dependency
Maven
<dependency>
<groupId>io.quarkiverse.flow</groupId>
<artifactId>quarkus-flow</artifactId>
<version>0.1.1</version>
</dependency>
2) Define a minimal workflow
Create a Flow subclass. At build time, Quarkus Flow discovers it and makes it injectable.
package org.acme;
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.set;
import jakarta.enterprise.context.ApplicationScoped;
import io.quarkiverse.flow.Flow;
import io.serverlessworkflow.api.types.Workflow;
import io.serverlessworkflow.fluent.func.FuncWorkflowBuilder;
@ApplicationScoped
public class HelloWorkflow extends Flow {
@Override
public Workflow descriptor() {
return FuncWorkflowBuilder.workflow("hello")
// jq expression to set our context to the JSON object `message`
.tasks(set("{ message: \"hello world!\" }"))
.build();
}
}
3) Run it (two ergonomic options)
Inject the Flow subclass (recommended)
package org.acme;
import java.util.Map;
import java.util.concurrent.CompletionStage;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import org.jboss.resteasy.reactive.ResponseStatus;
@Path("/hello")
@ApplicationScoped
public class HelloResource {
@Inject
HelloWorkflow hello; // inject the Flow subclass
@GET
@ResponseStatus(200)
public CompletionStage<Message> hello() {
return hello
.startInstance(Map.of()) // convenience on Flow
.thenApply(w -> w.as(Message.class).orElseThrow());
}
}
Or inject the compiled definition (advanced)
If you need a WorkflowDefinition, inject it by FQCN:
import io.smallrye.common.annotation.Identifier;
import io.serverlessworkflow.impl.WorkflowDefinition;
@Inject
@Identifier("org.acme.HelloWorkflow") // FQCN of the workflow class
WorkflowDefinition helloDef;
What’s next?
-
Java DSL cheatsheet — common patterns and snippets
-
Agentic workflows — agents, critique/revise loops, HITL
-
Messaging — emit/listen event patterns
-
Configuration — all config keys and generated tables