Coder Social home page Coder Social logo

iq-scm / vice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matryer/vice

0.0 0.0 0.0 226 KB

Go channels at horizontal scale (powered by message queues)

Home Page: https://medium.com/@matryer/introducing-vice-go-channels-across-many-machines-bcac1147d7e2

License: Apache License 2.0

Shell 0.62% Go 99.38%

vice's Introduction

Go channels at horizontal scale Build Status

  • Use Go channels transparently over a messaging queue technology of your choice (Currently NATS, Redis or NSQ, Amazon 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

Usage

This 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))
}
  • The code above is illustrative, be sure to read the design patterns
  • 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)
  • Install Vice with go get github.com/matryer/vice/...
  • Select a messaging queue technology
  • Build a command to run your service

Read the blog post: Introducing vice: Go channels across many machines

Acknowledgements

Special thanks go to David Hernandez, Jason Hancock and Piotr Rojek for their support on this project.

vice's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.