Easy Work - The simple, easy-used, stupid workflow engine for Java

Published: (December 9, 2025 at 10:49 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is Easy Work?

Easy Work is a workflow engine for Java. It provides concise APIs and building blocks for creating and running composable workflows.

In Easy Work, work units are represented by the Work interface, while workflows are represented by the WorkFlow interface.

Easy Work provides six implementation methods for the WorkFlow interface:

Flow

Those are the only basic flows you need to know to start creating workflows with Easy Work. You don’t need to learn a complex notation or concepts, just a few natural APIs that are easy to think about.

How does it work?

First, let’s write some work:

public class PrintMessageWork implements Work {

    private final String message;

    public PrintMessageWork(String message) {
        this.message = message;
    }

    @Override
    public String execute(WorkContext workContext) {
        System.out.println(message);
        return message;
    }
}

This unit of work prints a given message to the standard output. Now let’s suppose we want to create the following workflow:

  • print a three times
  • then print b c d in sequence
  • then print e f in parallel
  • if both e and f have been successfully printed, print g; otherwise print h
  • finally print z

The workflow can be illustrated as follows:

Example

  • flow1 is a RepeatFlow that prints a three times.
  • flow2 is a SequentialFlow that prints b, c, d in order.
  • flow3 is a ParallelFlow that prints e and f in parallel.
  • flow4 is a ConditionalFlow; it executes flow3 and, if the result is successful (Complete), executes g, otherwise h.
  • flow5 is a SequentialFlow that runs flow1, flow2, flow4, and finally z.

With Easy Work, this workflow can be implemented with the following snippet:

PrintMessageWork a = new PrintMessageWork("a");
PrintMessageWork b = new PrintMessageWork("b");
PrintMessageWork c = new PrintMessageWork("c");
PrintMessageWork d = new PrintMessageWork("d");
PrintMessageWork e = new PrintMessageWork("e");
PrintMessageWork f = new PrintMessageWork("f");
PrintMessageWork g = new PrintMessageWork("g");
PrintMessageWork h = new PrintMessageWork("h");
PrintMessageWork z = new PrintMessageWork("z");

WorkFlow flow = aNewSequentialFlow(
    aNewRepeatFlow(a).times(3),
    aNewSequentialFlow(b, c, d),
    aNewConditionalFlow(
        aNewParallelFlow(e, f).withAutoShutDown(true)
    ).when(
        WorkReportPredicate.COMPLETED,
        g,
        h
    ),
    z
);
aNewWorkFlowEngine().run(flow, new WorkContext());

This example is simple, but it demonstrates how to compose workflows with Easy Work.

You can view more test cases in test/java.

For additional details, see the wiki.

Back to Blog

Related posts

Read more »

Java projects of backend for beginners

!Forem Logohttps://media2.dev.to/dynamic/image/width=65,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%...

Welcome Thread - v355

Forem Feed !Forem Logohttps://media2.dev.to/dynamic/image/width=65,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.co...