iwf-java-sdk
Java SDK for iWF workflow engine
See samples for how to use this SDK to build your workflow.
Requirements
- Java 1.8+
How to use
Here is the link to all the versions on Maven available to use. It gets replicated from staging repo after 30-60 minutes.
Also the Java docs for the latest version. For the latest version, MVN Repository website may have 1~2 days delay to show up.
Gradle
// https://mvnrepository.com/artifact/io.iworkflow/iwf-java-sdk implementation 'io.iworkflow:iwf-java-sdk:2.5.+'
Maven
<!-- https://mvnrepository.com/artifact/io.iworkflow/iwf-java-sdk -->
<dependency>
<groupId>io.iworkflow</groupId>
<artifactId>iwf-java-sdk</artifactId>
<version>2.5.+</version>
<type>pom</type>
</dependency>
Concepts
To implement a workflow, the two most core interfaces are
-
Workflow interface defines the workflow definition
-
WorkflowState interface defines the workflow states for workflow definitions
A workflow can contain any number of WorkflowStates.
See more in https://github.com/indeedeng/iwf#what-is-iwf
How to build & run
Using IntelliJ
- Check out the idl submodule by running the command:
git submodule update --init --recursive - In "Build, Execution, Deployment" -> "Gradle", choose "wrapper task in Gradle build script" for "Use gradle from".
- Open Gradle tab, click "build" under "build" to build the project
Development Guide
Update IDL
Run the command git submodule update --remote --merge to update IDL to the latest commit
Local testing
If you'd like to test your changes to the SDK with the workflows in the samples repo, use the local publishing command:
- Run:
./gradlew publishToMavenLocal -x signMavenJavaPublication
- In the samples repo, make sure your
build.gradledepends on the same version you just published. To find which version you published, open the SDK'sbuild.gradlefile and look for theversion = "x.y.z"line near the bottom of the file. Then run:
./gradlew --refresh-dependencies build
- Once you're done, to remove the locally published version, run:
./gradlew unpublishFromMavenLocal
Repo structure
.github/workflows/: the GithubActions workflowsiwf-idl/: the idl submodulescript/: some scripts for GithubActions and testingsrc/: Java source codemain/java/io/iworkflow/core/: SDK codecommand/: the command implementationcommunication/: the communication implementationmapper/: the mapper with IDLpersistence/: the persistence implementationvalidator/: some validatorsClient.java: the client implemntation...java...
test/java/io/iworkflow/: Java test code (currently only integ test)spring/: the integ test setup of using Spring as REST controllerinteg/: the integration testsXyzTest.java: a file for test casesxyz/: the iWF workflow implementation for the integration test cases
Development Plan
1.0
- Start workflow API
- Executing
start/decideAPIs and completing workflow - Parallel execution of multiple states
- Timer command
- Signal command
- SearchAttribute
- DataAttribute
- StateExecutionLocal
- Signal workflow API
- Get workflow DataAttributes/SearchAttributes API
- Get workflow API
- Search workflow API
- Cancel workflow API
- Reset workflow API
- InternalChannel command
- AnyCommandCompleted Decider trigger type
- More workflow start options: IdReusePolicy, cron schedule, retry
- StateOption: WaitUntil/Execute API timeout and retry policy
- Reset workflow by stateId/StateExecutionId
1.1
- New search attribute types: Double, Bool, Datetime, Keyword array, Text
- Workflow start options: initial search attributes
1.2
- Skip timer API for testing/operation
- Decider trigger type: any command combination
1.3
- Support failing workflow with results
- Improve workflow uncompleted error return(canceled, failed, timeout, terminated)
1.4
- Support PROCEED_ON_FAILURE for WaitUntilApiFailurePolicy
2.0
- Renaming some concepts/APIs with breaking changes(see releaste notes)
- Support workflow RPC
2.1
- Support caching on persistence
2.2
- Support atomic conditional complete workflow by checking signal/internal channel emptiness
2.3
- Support dynamic data/search attributes and internal/signal channel definition
- Support state options overridden dynamically
- Support describe workflow API
2.4
- Support execute API failure policy
- Support RPC persistence locking policy
2.5
- Add waitForStateExecutionCompletion API
2.6
- Small breaking changes to IdReusePolicy for fixing typo