You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41-15Lines changed: 41 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ Provides the Java API for the [Serverless Workflow Specification](https://github
8
8
With the SDK you can:
9
9
10
10
* Read workflow JSON and YAML definitions
11
-
* Write workflow in JSON and YAML format.
11
+
* Write workflow definitions in JSON and YAML formats.
12
+
* Test your workflow definitions using the reference implementation.
12
13
13
-
Serverless Workflow Java SDK is **not** a workflow runtime implementation but can be used by Java runtime implementations to parse workflow definitions.
14
14
15
-
###Status
15
+
## Status
16
16
17
17
| Latest Releases | Conformance to spec version |
18
18
| :---: | :---: |
@@ -25,17 +25,18 @@ Serverless Workflow Java SDK is **not** a workflow runtime implementation but ca
25
25
26
26
Note that 6.0.0.Final, which will be the one for specification version 0.9, is skipped intentionally in case someone want to work on it.
27
27
28
-
###JDK Version
28
+
## JDK Version
29
29
30
30
| SDK Version | JDK Version |
31
31
| :---: | :---: |
32
+
| 7.0.0 and after | 17 |
32
33
| 5.0.0 and after | 11 |
33
34
| 4.0.x and before | 8 |
34
35
35
-
###Getting Started
36
+
## Getting Started
36
37
37
38
38
-
####Building SNAPSHOT locally
39
+
### Building SNAPSHOT locally
39
40
40
41
To build project and run tests locally:
41
42
@@ -47,7 +48,7 @@ mvn clean install
47
48
The project uses [Google's code styleguide](https://google.github.io/styleguide/javaguide.html).
48
49
Your changes should be automatically formatted during the build.
49
50
50
-
####Maven projects:
51
+
### Maven projects:
51
52
52
53
Add the following dependencies to your pom.xml `dependencies` section:
53
54
@@ -59,19 +60,28 @@ Add the following dependencies to your pom.xml `dependencies` section:
59
60
</dependency>
60
61
```
61
62
62
-
####Gradle projects:
63
+
### Gradle projects:
63
64
64
65
Add the following dependencies to your build.gradle `dependencies` section:
There are, roughly speaking, two kind of users of this SDK:
74
+
* Those ones interested on implementing their own runtime using Java.
75
+
* Those ones interested on using the provided runtime reference implementation.
73
76
74
-
You can create a Workflow instance from JSON/YAML source:
77
+
### Implementing your own runtime
78
+
79
+
For those ones interested on implementing their own runtime, this SDK provides an easy way to load an in memory representation of a given workflow definition.
80
+
This in-memory representation consists of a hierarchy of POJOS directly generated from the Serverless Workflow specification [schema](api/src/main/resources/schema/workflow.yaml), which ensures the internal representation is aligned with the specification schema. The root of the hierarchy is `io.serverlessworkflow.api.types.Workflow` class
81
+
82
+
### Reading workflow definition from JSON/YAML source
83
+
84
+
You can read a Workflow definition from JSON/YAML source:
75
85
76
86
Let's say you have a simple YAML based workflow definition in a file name `simple.yaml` located in your working dir:
77
87
@@ -93,7 +103,7 @@ do:
93
103
94
104
```
95
105
96
-
To parse it and create a Workflow instance you can do:
106
+
To parse it and get a Workflow instance you can do:
97
107
98
108
```java
99
109
@@ -102,15 +112,31 @@ try (InputStream in = new FileInputStream("simple.yaml")) {
102
112
// Once you have the Workflow instance you can use its API to inspect it
103
113
}
104
114
```
115
+
By default, Workflows are not validated against the schema (performance being the priority). If you want to enable validation, you can do that by using:
116
+
117
+
```java
118
+
try (InputStream in =newFileInputStream("simple.yaml")) {
// Once you have the Workflow instance you can use its API to inspect it
121
+
}
122
+
```
105
123
106
-
#### Writing a workflow
124
+
For additional reading helper methods, including the one to read a workflow definition from classpath, check [WorkflowReader](api/src/main/java/io/serverlessworkflow/api/WorkflowReader.java) class.
107
125
108
-
Given a workflow definition, you can store it using JSON or YAML format.
126
+
### Writing workflow definition to a JSON/YAML target
127
+
128
+
Given a Workflow instance, you can store it using JSON or YAML format.
109
129
For example, to store a workflow using json format in a file called `simple.json`, you write
110
130
111
131
```java
112
132
try (OutputStream out =newFileOutputStream("simple.json")) {
For additional writing helper methods, check [WorkflowWriter](api/src/main/java/io/serverlessworkflow/api/WorkflowWriter.java) class.
138
+
139
+
### Reference implementation
140
+
141
+
The reference implementation provides a ready-to-use runtime that supports the Serverless Workflow Specification. It includes a workflow execution engine, validation utilities, and illustrative examples to help you quickly test and deploy your workflows. For details on usage, configuration, and supported features, see [readme](impl/README.md).
0 commit comments