Skip to content

Commit 59fa4c5

Browse files
committed
Readme updates for release
Signed-off-by: Francisco Javier Tirado Sarti <[email protected]>
1 parent eb5718f commit 59fa4c5

File tree

3 files changed

+41
-18
lines changed

3 files changed

+41
-18
lines changed

examples/events/src/main/java/events/EventExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static void main(String[] args) throws IOException {
3737
WorkflowInstance waitingInstance = listenDefinition.instance(Map.of());
3838
waitingInstance
3939
.start()
40-
.thenAccept(node -> logger.info("Waiting instance completed with result {}", node));
40+
.thenAccept(output -> logger.info("Waiting instance completed with result {}", output));
4141
logger.info("Listen instance waiting for proper event, Status {}", waitingInstance.status());
4242
logger.info("Publishing event with temperature 35");
4343
emitDefinition.instance(Map.of("temperature", 35)).start().join();

examples/simpleGet/src/main/java/io/serverlessworkflow/impl/NotBlockingExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void main(String[] args) throws IOException {
3030
appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("get.yaml"))
3131
.instance(Map.of("petId", 10))
3232
.start()
33-
.thenAccept(node -> logger.info("Workflow output is {}", node));
33+
.thenAccept(output -> logger.info("Workflow output is {}", output));
3434
logger.info("The request has been sent, this thread might continue doing stuff");
3535
}
3636
}

impl/README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@
55

66
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.
77

8-
Although initially conceived mainly for testing purposes, it was designed to be easily expanded, so it can eventually become production ready.
9-
108
## Status
119

1210
This reference implementation is currently capable of running workflows consisting of:
1311

14-
1512
* Tasks
1613
* Switch
1714
* Set
@@ -25,6 +22,9 @@ This reference implementation is currently capable of running workflows consisti
2522
* Wait
2623
* Call
2724
* HTTP
25+
* Basic authentication
26+
* Bearer authentication
27+
* OAuth2 authentication
2828
* Schema Validation
2929
* Input
3030
* Output
@@ -34,6 +34,14 @@ This reference implementation is currently capable of running workflows consisti
3434
* Export
3535
* Special keywords: runtime, workflow, task...
3636
* Error definitions
37+
* Lifecycle events:
38+
* Pending
39+
* Started
40+
* Suspended
41+
* Faulted
42+
* Resumed
43+
* Cancelled
44+
* Completed
3745

3846

3947
## Setup
@@ -47,19 +55,19 @@ Install [Gradle](https://gradle.org/install) (if using Gradle)
4755
### Dependencies
4856

4957
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.
5160
- Additional dependencies must be explicitly included if your workflow interacts with external services (e.g., HTTP).
5261
This ensures you only include what you need, preventing unnecessary dependencies.
5362

5463
#### Maven
5564

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:
5766

5867
```xml
5968
<dependency>
6069
<groupId>io.serverlessworkflow</groupId>
61-
<artifactId>serverlessworkflow-impl-core</artifactId>
62-
<version>7.0.0.Final</version>
70+
<artifactId>serverlessworkflow-impl-jackson</artifactId>
6371
</dependency>
6472
```
6573

@@ -69,24 +77,40 @@ And only if your workflow is using HTTP calls, you must add:
6977
<dependency>
7078
<groupId>io.serverlessworkflow</groupId>
7179
<artifactId>serverlessworkflow-impl-http</artifactId>
72-
<version>7.0.0.Final</version>
7380
</dependency>
7481
```
7582

83+
If you http call requires Oauth2 authorization, you must add:
84+
85+
```xml
86+
<dependency>
87+
<groupId>io.serverlessworkflow</groupId>
88+
<artifactId>serverlessworkflow-impl-jackson-jwt</artifactId>
89+
</dependency>
90+
```
91+
92+
7693
#### Gradle projects:
7794

78-
You always need to add this dependency to your build.gradle `dependencies` section:
95+
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:
7996

8097
```text
81-
implementation("io.serverlessworkflow:serverlessworkflow-impl-core:7.0.0.Final")
98+
implementation("io.serverlessworkflow:serverlessworkflow-impl-jackson")
8299
```
83100

84101
And only if your workflow is using HTTP calls, you must add:
85102

86103
```text
87-
implementation("io.serverlessworkflow:serverlessworkflow-impl-http:7.0.0.Final")
104+
implementation("io.serverlessworkflow:serverlessworkflow-impl-http")
105+
```
106+
107+
If you http call requires Oauth2 authorization, you must add:
108+
109+
```text
110+
implementation("io.serverlessworkflow:serverlessworkflow-impl-jackson-jwt")
88111
```
89112

113+
90114
## How to use
91115

92116
The quick version is intended for impatient users who want to try something as soon as possible.
@@ -121,7 +145,7 @@ In order to execute the workflow without blocking the calling thread till the HT
121145
appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("get.yaml"))
122146
.instance(Map.of("petId", 10))
123147
.start()
124-
.thenAccept(node -> logger.info("Workflow output is {}", node));
148+
.thenAccept(output -> logger.info("Workflow output is {}", output));
125149
}
126150
```
127151
When the HTTP request is done, both examples will print a similar output
@@ -168,12 +192,12 @@ To execute a workflow, we first create a [WorkflowInstance](core/src/main/java/i
168192
WorkflowInstance waitingInstance = listenDefinition.instance(Map.of());
169193
waitingInstance
170194
.start()
171-
.thenAccept(node -> logger.info("Waiting instance completed with result {}", node));
195+
.thenAccept(output -> logger.info("Waiting instance completed with result {}", output));
172196
```
173197

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`
175199

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.
177201

178202
```java
179203
emitDefinition.instance(Map.of("temperature", 35)).start().join();
@@ -191,4 +215,3 @@ After that, listen instance will be completed and we will see this log message
191215
[pool-1-thread-1] INFO events.EventExample - Waiting instance completed with result [{"temperature":39}]
192216
```
193217
The source code of the example is [here](../examples/events/src/main/java/events/EventExample.java)
194-

0 commit comments

Comments
 (0)