matryer / vice
- воскресенье, 30 июля 2017 г. в 03:13:48
Go channels at horizontal scale (powered by message queues)
vice.Transport
to change underlying queueing technologies transparentlyThis code receives names on the |names|
queue, and sends greetings on the |greetings|
queue:
// 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))
}
Send
and Receive
methods to get channels, which you can then use as normalErrChan()
error channel to make sure the underlying queue technology is healthygo get github.com/matryer/vice/...
Read the blog post: Introducing vice: Go channels across many machines
Special thanks go to David Hernandez, Jason Hancock and Piotr Rojek for their support on this project.