/node-graph-flow

Simple frame for node graph inspired task processing.

Primary LanguageGoGNU Lesser General Public License v2.1LGPL-2.1

node-graph-flow codecov GoDoc

node graph flow

Simple frame for node graph inspired task processing.

Disclaimer:

  • Each individual flow can be executed concurrently on separate goroutines.

  • At node level, all nodes of an individual graph should execute on the same goroutine (synchronous).


My intended purpose is to use this with https://github.com/WolvenSpirit/postgres-queue but it is just a few lines of code to provide a frame or example for any sort of node based separation of steps that together can define a task flow.


Why define a generic task or a handler like this?

Main reasons:

✅ Handle errors consistently.

✅ Handle program conditional logic flows consistently.

✅ Have a recorded and traceable logic flow throughout task execution.


✅ Now makes full use of Go Generics (go 1.18)

✅ Provides optional onFinished hook on each node. No matter if the node fails or succeeds, a custom clean-up function can run that might perform additional checks or store metrics regarding the outcome.


Examples for using this package can be found in the examples folder.