An open API service indexing awesome lists of open source software.

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.

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