Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matryer/vice
Go channels at horizontal scale (powered by message queues)
https://github.com/matryer/vice
channels golang idiomatic queues
Last synced: 3 months ago
JSON representation
Go channels at horizontal scale (powered by message queues)
- Host: GitHub
- URL: https://github.com/matryer/vice
- Owner: matryer
- License: apache-2.0
- Created: 2017-07-27T19:20:18.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-22T03:09:35.000Z (over 2 years ago)
- Last Synced: 2024-06-19T14:10:29.546Z (5 months ago)
- Topics: channels, golang, idiomatic, queues
- Language: Go
- Homepage: https://medium.com/@matryer/introducing-vice-go-channels-across-many-machines-bcac1147d7e2
- Size: 221 KB
- Stars: 1,532
- Watchers: 35
- Forks: 81
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - vice - Go channels at horizontal scale (powered by message queues) (Go)
README
![](docs/vicelogo-small.png)
# Go channels at horizontal scale [![Build Status](https://travis-ci.org/matryer/vice.svg?branch=master)](https://travis-ci.org/matryer/vice)
* Use Go channels transparently over a [messaging queue technology of your choice](https://github.com/matryer/vice/tree/master/queues) (Currently [NATS](http://nats.io), [Redis](http://redis.io) or [NSQ](http://nsq.io), [Amazon SQS](https://aws.amazon.com/sqs/))
* Swap `vice.Transport` to change underlying queueing technologies transparently
* Write idiomatic Go code instead of learning queue specific APIs
* Develop against in-memory implementation before putting it into the wild
* Independent unit tests (no need for running queue technology)PROJECT STATUS: [v1 released](https://github.com/matryer/vice/releases/tag/v1.0.0)
## Usage
This code receives names on the `|names|` queue, and sends greetings on the `|greetings|`
queue:```go
// get a Go channel that will receive messages on the
// |names| queue
names := transport.Receive("names")// get a Go channel that will send messages on the
// |greetings| queue
greetings := transport.Send("greetings")// respond to |names| messages with |greetings|
for name := range names {
greetings <- []byte("Hello " + string(name))
}
```* The code above is illustrative, be sure to read the [design patterns](https://github.com/matryer/vice/blob/master/docs/design-patterns.md)
* Always stop the Transport, some technologies register and deregister their interest in the queues (this means trapping signals and gracefully shutting down services before exiting)
* Use `Send` and `Receive` methods to get channels, which you can then use as normal
* Be sure to always handle the `ErrChan()` error channel to make sure the underlying queue technology is healthy## Quick start guide
* Write your services with unit tests using normal Go channels (see our [design patterns](https://github.com/matryer/vice/blob/master/docs/design-patterns.md))
* Install Vice with `go get github.com/matryer/vice/...`
* Select a [messaging queue technology](https://github.com/matryer/vice/tree/master/queues)
* Build a command to run your serviceRead the blog post: [Introducing vice: Go channels across many machines](https://medium.com/@matryer/introducing-vice-go-channels-across-many-machines-bcac1147d7e2)
## Acknowledgements
Special thanks go to [David Hernandez](https://github.com/dahernan), [Jason Hancock](https://github.com/jasonhancock) and [Piotr Rojek](https://github.com/piotrrojek) for their support on this project.