Skip to content

Commit

Permalink
[Fix serverlessworkflow#520] More comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Jan 30, 2025
1 parent cbd1623 commit 2b9f6cf
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions impl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Reference implementation requires [Java 17](https://openjdk.org/projects/jdk/17/

### Dependencies

One of the goals of the reference implementation is to maintain the number of dependencies as lower as possible. With that spirit, a modular approach has been followed, letting the users decide, depending on their workflows nature, which dependencies should be include.
One goal of the reference implementation is including the lowest number of dependencies possible. In that spirit, a modular approach has been used, letting the user decide which dependencies to include based on the nature of their workflow.

In practical terms, this means a separation between the core part and additional dependencies that should be explicitly included if your workflow is interacting with an external service that communicated using a particular technology supported by the specification (at this moment, just HTTP). The intention of this is to avoid adding dependencies that you do not need (for example, when gRPC call will be implemented, if we were adding the gRPC stack to the core dependencies, you won't be able to get rid of it even if none of your workflows use it)
In practical terms, this means establishing a separation between the core part and additional dependencies that should be explicitly included if your workflow is interacting with an external service using a particular technology supported by the specification (at this moment, just HTTP). The intention of this is to avoid adding dependencies that you do not need. For example, when gRPC call will be implemented, if we were adding the gRPC stack to the core dependencies, you won't be able to get rid of it even if none of your workflows use it.

#### Maven

Expand All @@ -72,8 +72,6 @@ And only if your workflow is using HTTP calls, you must add:
</dependency>
```



### Gradle projects:

You always need to add this dependency to your build.gradle `dependencies` section:
Expand All @@ -88,7 +86,6 @@ And only if your workflow is using HTTP calls, you must add:
implementation("io.serverlessworkflow:serverlessworkflow-impl-http:7.0.0-SNAPSHOT")
```


## How to use

The quick version is intended for impatient users who want to try something as soon as possible.
Expand Down Expand Up @@ -168,9 +165,9 @@ To execute a workflow, we first create a [WorkflowInstance](core/src/main/java/i
.thenAccept(node -> logger.info("Waiting instance completed with result {}", node));
```
The next line will be executed as soon as the workflow execution starts waiting for events to arrive, moment at which control is returned to the calling thread. Therefore, we can execute another workflow instance while the first one is waiting.
As soon as the workflow execution reach the point where it waits for events to arrive, control is returned to the calling thread. Therefore, we can execute another workflow instance while the first one is waiting.
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 before executing the following line, we call `join` after `start`, telling the `CompletableFuture` to wait for workflow completion.
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.
```java
emitDefinition.instance(Map.of("temperature", 35)).start().join();
Expand Down

0 comments on commit 2b9f6cf

Please sign in to comment.