Skip to content

bitlap/kflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KFlow

Kotlin DSL for DAG-Flow execute engine.

1. Examples

  • Quick start
// 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
/**
 * 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

About

Kotlin DSL for DAG-Flow execute engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages