in

Chanman helps you to create queue channels and manage them gracefully


Channels are widely used as queues. chanman (Channel Manager) helps you to easily create queue with channel and manage the data in the queue. You don’t have to be afraid of panic situations like channel is already closed etc.

Usage

func main() {
	callbackFn := func(data interface{}) error {
		fmt.Printf("Processed data: %vn", data)
		return nil
	}

	opts := &chanman.Options{
		CallbackFn: callbackFn,
		Limit:      10,
	}

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	queue := chanman.New(ctx, opts)

	go queue.Listen()

	for i := 0; i <= 20; i++ {
		queue.Add(fmt.Sprintf("job-%d", i))
	}
}

GitHub

https://github.com/yakuter/chanman




Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

GIPHY App Key not set. Please check settings

10 Best Game Boosters for Android and PC

PO File Editor — Free editor for translations in portable object files