WaterFlow is a non-magical - relatively small framework for use with Amazon SWF.
Browse the online documentation
The framework is deeply routed in the original implementation of SWiFt which is a great example of achieving a very usable and simple SWF framework.
WaterFlow aims to add new features that are common in the AWS Flow Framework without the need for AspectJ and the magical annotation processing that occurs.
Here is a short list of philosophy decisions that differentiate this framework from SWiFt and Glisten
DataConverter
<dependency>
<groupId>com.github.fzakaria</groupId>
<artifactId>WaterFlow</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
Several examples have been included within the com.github.fzakaria.waterflow.example package that demonstrate the full range of features offered by the framework.
You can use them as a learning example or even run them yourself. Included are some integration tests that verify that the workflows perform their expected operations. Take a look at the ExamplesIntegrationTest.java file.
Talk is cheap, show me some code
@Value.Immutable
public abstract class ExampleActivities extends Activities {
@ActivityMethod(name = "Addition", version = "1.0")
public Integer addition(Integer lhs, Integer rhs) {
return lhs + rhs;
}
}
@Value.Immutable
public abstract class SimpleWorkflow extends Workflow<Integer, Integer> {
final IntegerActivityAction step1 = IntegerActivityAction.builder().actionId(ActionId.of("step1"))
.name(Name.of("Addition")).version(Version.of("1.0")).workflow(this).build();
@Override
public CompletionStage<Integer> decide(DecisionContext decisionContext) {
// Set a breakpoint below to watch the decisions list to see what gets added on each call to Workflow.decide()
CompletionStage<Integer> input = workflowInput(decisionContext.events());
return input
.thenCompose(i -> step1.withInput(i, 1).decide(decisionContext))
.thenCompose(step1i -> step2.withInput(step1i, 100).decide(decisionContext));
}
}
DataConverter