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: impl/README.md
+38-15Lines changed: 38 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,10 @@
5
5
6
6
Welcome to Java SDK runtime reference implementation, a lightweight implementation of the Serverless Workflow specification which provides a simple, non blocking, reactive API for workflow execution.
7
7
8
-
Although initially conceived mainly for testing purposes, it was designed to be easily expanded, so it can eventually become production ready.
9
-
10
8
## Status
11
9
12
10
This reference implementation is currently capable of running workflows consisting of:
13
11
14
-
15
12
* Tasks
16
13
* Switch
17
14
* Set
@@ -25,6 +22,9 @@ This reference implementation is currently capable of running workflows consisti
25
22
* Wait
26
23
* Call
27
24
* HTTP
25
+
* Basic authentication
26
+
* Bearer authentication
27
+
* OAuth2 authentication
28
28
* Schema Validation
29
29
* Input
30
30
* Output
@@ -34,6 +34,14 @@ This reference implementation is currently capable of running workflows consisti
34
34
* Export
35
35
* Special keywords: runtime, workflow, task...
36
36
* Error definitions
37
+
* Lifecycle events:
38
+
* Pending
39
+
* Started
40
+
* Suspended
41
+
* Faulted
42
+
* Resumed
43
+
* Cancelled
44
+
* Completed
37
45
38
46
39
47
## Setup
@@ -47,19 +55,19 @@ Install [Gradle](https://gradle.org/install) (if using Gradle)
47
55
### Dependencies
48
56
49
57
This implementation follows a modular approach, keeping dependencies minimal:
50
-
- The core library is always required.
58
+
- There is the core library, `serverlessworkflow-impl-core`, which depends on the types generated from the workflow schema and CloudEvent SDK. It contains the workflow engine implementation and those interfaces the user will operate with.
59
+
- There is the Jackson library, `serverlessworkflow-impl-jackson`, which depends on core and contains Jackson depending stuff, among others, JQ expression implementation, Json schema validation implementation and Jackson cloud events marshalling/unmarshalling. This is the library most users will include as dependency in their modules.
51
60
- Additional dependencies must be explicitly included if your workflow interacts with external services (e.g., HTTP).
52
61
This ensures you only include what you need, preventing unnecessary dependencies.
53
62
54
63
#### Maven
55
64
56
-
You always need to add this dependency to your pom.xml `dependencies` section:
65
+
In order to execute workflows written in YAML that use JQ expression, you just need to add this dependency to your pom.xml `dependencies` section:
.thenAccept(node-> logger.info("Workflow output is {}", node));
148
+
.thenAccept(output-> logger.info("Workflow output is {}", output));
125
149
}
126
150
```
127
151
When the HTTP request is done, both examples will print a similar output
@@ -171,9 +195,9 @@ To execute a workflow, we first create a [WorkflowInstance](core/src/main/java/i
171
195
.thenAccept(node -> logger.info("Waiting instance completed with result {}", node));
172
196
```
173
197
174
-
As soon as the workflow execution reach the point where it waits for events to arrive, control is returned to the calling thread. Since the execution is not blocking, we can execute another workflow instance while the first one is waiting.
198
+
As soon as the workflow execution reach the point where it waits for events to arrive, control is returned to the calling thread. Since the execution is not blocking, we can execute another workflow instance while the first one is waiting. Also, you might suspend workflow execution by calling `WorkflowInstance::suspend` (the workflow progress will be paused till you invoke `WorkflowInstance::resume`). In case workflow execution needs to be aborted you might use `WorkflowInstance::cancel`
175
199
176
-
We will send an event with a temperature that does not satisfy the criteria, so the listen instance will continue waiting. We use a regular Java `Map` to pass parameters to the workflow instance that sends the event. Note that since we want to wait till the event is published, we call `join` after `start`, telling the `CompletableFuture` to wait for workflow completion.
200
+
In this example, we are invoking a workflow that publishes an event with a temperature that does not satisfy the waiting criteria, so the listen instance will continue waiting. We use a regular Java `Map` to pass parameters to the workflow instance that sends the event. Note that since we want to wait till the event is published, we call `join` after `start`, telling the `CompletableFuture` to wait for workflow completion.
0 commit comments