Skip to content
/ kudruk Public

Kudruk helps you to create queue channels and manage them gracefully.

License

Notifications You must be signed in to change notification settings

yakuter/kudruk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kudruk

Channels are widely used as queues. kudruk (means queue in Turkish) 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: %v\n", data)
		return nil
	}

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

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

	queue := kudruk.New(ctx, opts)

	go queue.Listen()

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

About

Kudruk helps you to create queue channels and manage them gracefully.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages