Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiacai2050/prosumer
A producer-consumer solution for Golang
https://github.com/jiacai2050/prosumer
channel golang goroutines producer-consumer prosumer select
Last synced: about 1 month ago
JSON representation
A producer-consumer solution for Golang
- Host: GitHub
- URL: https://github.com/jiacai2050/prosumer
- Owner: jiacai2050
- License: mit
- Created: 2019-07-14T08:53:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-05T04:39:52.000Z (over 4 years ago)
- Last Synced: 2024-06-20T11:58:42.550Z (6 months ago)
- Topics: channel, golang, goroutines, producer-consumer, prosumer, select
- Language: Go
- Homepage: https://pkg.go.dev/github.com/jiacai2050/prosumer?tab=doc
- Size: 23.4 KB
- Stars: 33
- Watchers: 1
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prosumer
[![GoDoc](https://godoc.org/github.com/jiacai2050/prosumer?status.svg)](https://godoc.org/github.com/jiacai2050/prosumer)
[![Build Status](https://travis-ci.org/jiacai2050/prosumer.svg?branch=master)](https://travis-ci.org/jiacai2050/prosumer)
[![codecov](https://codecov.io/gh/jiacai2050/prosumer/branch/master/graph/badge.svg)](https://codecov.io/gh/jiacai2050/prosumer)A producer-consumer solution for Golang.
## Motivation
Go is popular for its simplicity, builtin support for concurrency, light-weight goroutine. However, there are some tricks([here](https://dave.cheney.net/2013/04/30/curious-channels) and [there](https://github.com/golang/go/issues/11344)) when to coordinate among different goroutines, especially when implements [producer-consumer pattern](https://dzone.com/articles/producer-consumer-pattern) using buffered chan.
I don't want cover details here, guys who interested can check links above. But following cannot be emphasized too much:
> Close chan is a `sender -> receiver` communication, not the reverse. [#11344](https://github.com/golang/go/issues/11344#issuecomment-117862884)
## Feature
- Inner buffer queue support RejectPolicy
- Graceful close implementedIf you have any suggestions/questions, open a PR.
## Usage
There is a [quickstart example](./examples/quickstart/main.go) , view the [GoDoc](https://godoc.org/github.com/jiacai2050/prosumer) for details.
## License
[MIT License](./LICENSE)