Code Monkey home page Code Monkey logo

takeanumber's Introduction

takeanumber

A simplistic queue server written in Go.

takeanumber is an in-memory networked queue server, allowing you to delay processing by storing messages in one process & consuming those messages in other processes.

This is especially useful in web applications, allowing you to take non-critical processing out of the request-response cycle, though there are many other applications.

takeanumber exposes its functionality over a plain-text protocol via a TCP socket. These messages conform to a subset of the Redis Serialization Protocol (http://redis.io/topics/protocol), so in theory an existing Redis client may be able to talk to takeanumber.

Quickstart

Starting a server (on localhost, port 13331):

$ takeanumber -p 13331

You can then use tools like telnet to talk to takeanumber. Here's a sample session:

$ telnet localhost 13331
LEN my_queue
:0
ADD my_queue 0 Hello, world!
+bb713fbe-3c82-41c9-94f0-43c499bfac8c
ADD my_queue 3 {"user_id": 5, "action": "send_welcome_email"}
+4aaf88df-390b-4a0a-8352-1fe258d94d3d
LEN my_queue
:2
RESERVE my_queue
+bb713fbe-3c82-41c9-94f0-43c499bfac8c Hello, world!
DONE my_queue bb713fbe-3c82-41c9-94f0-43c499bfac8c
+OK
LEN my_queue
:1
RESERVE my_queue
+4aaf88df-390b-4a0a-8352-1fe258d94d3d {"user_id": 5, "action": "send_welcome_email"}
RETRY my_queue 4aaf88df-390b-4a0a-8352-1fe258d94d3d
+OK
LEN my_queue
:1
CLOSE

This session did the following:

  • Checked the length of queue, bringing it into existence if not present
  • Added a "Hello, world!" message to the queue with no retries
  • Added a JSON message to the queue with 3 retries
  • Verified the length of the queue
  • Reserved the first item for processing then marked it as done
  • Reserved the second item, then marked it to be retried
  • Verified the message was in the queue
  • Closed the session

Building

takeanumber was built using Go 1.4+.

$ go get code.google.com/p/go-uuid/uuid
$ go build takeanumber.go

License

New BSD

Benchmarks

TBD

TODO

  • STATS command & statistics tracking
  • QUEUES command to return the queue names
  • Proper Go-based benchmarks

takeanumber's People

Contributors

toastdriven avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pombredanne

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.