https://github.com/bitlap/kflow
Kotlin DSL for DAG-Flow execute engine.
https://github.com/bitlap/kflow
Last synced: about 1 year ago
JSON representation
Kotlin DSL for DAG-Flow execute engine.
- Host: GitHub
- URL: https://github.com/bitlap/kflow
- Owner: bitlap
- License: mit
- Created: 2018-09-20T07:13:43.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-20T22:41:07.000Z (about 4 years ago)
- Last Synced: 2025-04-10T18:04:08.921Z (about 1 year ago)
- Language: Kotlin
- Size: 39.1 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KFlow
Kotlin DSL for DAG-Flow execute engine.
## 1. Examples
* Quick start
```kotlin
// start ---> node1 ---> node2 ---> end
val flow = flow {
// flow lines
start to "node1" to "node2" to end
// node handler
"node1" {
handler { flowData ->
flowData["node1"] = "node1Data"
println("${Thread.currentThread().name} -> node1 handle")
}
}
"node2" {
handler { flowData ->
println("${Thread.currentThread().name} -> node2 handle, get node1 data ${flowData["node1"]}")
}
}
}
flow.execute()
```
* ForkJoin example
```kotlin
/**
* start ---> node1 ------> node2 ---> node3 ----> end
* | ↑
* | |-----> f_node1 --- |
* |---> f_node |---> j_node
* |-----> f_node2 ---
*/
```
You can reference to test cases.
## 2. TODO
* [ ] `Execute context` other build-in features.
* [ ] Interrupt waiting/sleeping threads when throwing exception.
* [ ] TODO