Skip to content

Commit a63ad6c

Browse files
authored
readme_updates (#781)
Signed-off-by: fjtirado <ftirados@redhat.com>
1 parent 1ae7eac commit a63ad6c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

impl/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Full examples:
170170

171171
---
172172

173-
## Detailed Walkthrough
173+
## Event publish/subscribe example
174174

175175
We’ll coordinate two workflows—one **listens** for high temperatures and the other **emits** temperature events:
176176

@@ -181,8 +181,8 @@ Create an application (customize thread pools, etc.). `WorkflowApplication` is `
181181

182182
```java
183183
try (WorkflowApplication appl = WorkflowApplication.builder().build()) {
184-
var listen = appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("listen.yaml"));
185-
var emit = appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("emit.yaml"));
184+
WorkflowDefinition listen = appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("listen.yaml"));
185+
WorkflowDefinition emit = appl.workflowDefinition(WorkflowReader.readWorkflowFromClasspath("emit.yaml"));
186186

187187
// Start the listener (non-blocking)
188188
listen.instance(Map.of())
@@ -207,6 +207,12 @@ Source: `examples/events/src/main/java/events/EventExample.java`
207207

208208
---
209209

210+
## Workflow execution control
211+
212+
As shown in previous examples, to start a new workflow instance, first a [WorkflowInstance](https://github.com/serverlessworkflow/sdk-java/blob/main/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowInstance) is created from a [WorkflowDefinition](https://github.com/serverlessworkflow/sdk-java/blob/main/impl/core/src/main/java/io/serverlessworkflow/impl/WorkflowDefinition.java#L74), specifying the desired input, and then start method is invoked over it. Start method returns a CompletableFuture, which might be used to obtain the output, either synchronously or asynchronously.
213+
214+
Once started, and before it completes, a workflow instance execution can be suspended or cancelled. Once cancelled, a workflow instance is done, while a suspended one might be resumed.
215+
210216
## Fluent Java DSL
211217

212218
Prefer building workflows programmatically with type-safe builders and recipes?

0 commit comments

Comments
 (0)