channelify alternatives and similar packages
Based on the "Goroutines" category.
Alternatively, view channelify alternatives based on common mentions on social networks and blogs.
-
pool
Go consumer goroutine pool for easy goroutine handling + time saving. -
Goflow
Simply way to control goroutines execution order based on dependencies -
pond
Minimalistic and High-performance goroutine worker pool written in Go. -
artifex
Simple in-memory job queue for Golang using worker-based dispatching. -
async
A safe way to execute functions asynchronously, recovering them in case of panic. -
go-workers
Easily and safely run workers for large data processing pipelines. -
go-do-work
Dynamically resizable pools of goroutines which can queue an infinite number of jobs. -
semaphore
Semaphore pattern implementation with timeout of lock/unlock operations based on channel and context. -
gpool
manages a resizeable pool of context-aware goroutines to bound concurrency. -
neilotoole/errgroup
Drop-in alternative to sync/errgroup, limited to a pool of N worker goroutines. -
gollback
asynchronous simple function utilities, for managing execution of closures and callbacks. -
Hunch
Hunch provides functions like: All, First, Retry, Waterfall etc., that makes asynchronous flow control more intuitive. -
routine
go routine control with context, support: Main, Go, Pool and some useful Executors. -
goccm
Go Concurrency Manager package limits the number of goroutines that allowed to run concurrently. -
go-waitgroup
Like sync.WaitGroup with error handling and concurrency control. -
conexec
A concurrent toolkit to help execute funcs concurrently in an efficient and safe way.It supports specifying the overall timeout to avoid blocking and uses goroutine pool to improve efficiency. -
go-tools/multithreading
Manage a pool of goroutines using this lightweight library with a simple API. -
hands
A process controller used to control the execution and return strategies of multiple goroutines. -
queue
Gives you a sync.WaitGroup like queue group accessibility. Helps you to throttle and limit goroutines, wait for the end of the all goroutines and much more. -
concurrency-limiter
Concurrency limiter with support for timeouts , dynamic priority and context cancellation of goroutines. -
oversight
Oversight is a complete implementation of the Erlang supervision trees.
Scout APM - Leading-edge performance monitoring starting at $39/month
Do you think we are missing an alternative of channelify or a related project?
README
channelify
This library helps you to transform any function into a function that returns a any type to a function that return such types within a channel. This is useful to run in parallel multiple functions and have control on the returned values.
Channelify uses go routines to parallelize the execution of the functions.
The idea comes from Javascript Promisify utility that transforms a callback into a promise.
Installation
go get github.com/ddelizia/channelify
Usage example
Here an example of transforming a simple function in channel so you can execute multiple functions in parallel:
fn := func () string {
time.Sleep(time.Second * 3)
return "hello"
}
ch1 := Channelify(fn)
ch2 := Channelify(fn)
chV1 := ch1.(func () chan string)()
chV2 := ch2.(func () chan string)()
v1, v2 := <- chV1, <- chV2
If your functions returns multiple values you can use as follow:
fn1 := func (hello string) (string, error) {
time.Sleep(time.Second * 2)
fmt.Println(hello)
return hello, nil
}
fn2 := func (hello string) (string, error) {
time.Sleep(time.Second * 3)
fmt.Println(hello)
return hello, nil
}
ch1 := Channelify(fn1)
ch2 := Channelify(fn2)
chV1, chE1 := ch1.(func (string) (chan string, chan error))("hello1")
chV2, chE2 := ch2.(func (string) (chan string, chan error))("hello2")
v1, e1, v2, e2 := <- chV1, <- chE1, <- chV2, <- chE2
fmt.Print(v1, e1, v2, e2)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
*Note that all licence references and agreements mentioned in the channelify README section above
are relevant to that project's source code only.