GithubHelp home page GithubHelp logo

gobeanstalk's Introduction

#gobeanstalk Build Status GoDoc Coverage Status

Go Beanstalkd client library.

INSTALL

go get github.com/iwanbk/gobeanstalk

USAGE

Producer

import (
	"github.com/iwanbk/gobeanstalk"
	"log"
	"time"
)

func main() {
	conn, err := gobeanstalk.Dial("localhost:11300")
	if err != nil {
		log.Fatal(err)
	}

	id, err := conn.Put([]byte("hello"), 0, 10*time.Second, 30*time.Second)
	if err != nil {
		log.Fatal(err)
	}

	log.Printf("Job id %d inserted\n", id)
}

Consumer

import (
	"github.com/iwanbk/gobeanstalk"
	"log"
)

func main() {
	conn, err := gobeanstalk.Dial("localhost:11300")
	if err != nil {
		log.Fatal(err)
	}
	for {
		j, err := conn.Reserve()
		if err != nil {
			log.Fatal(err)
		}
		log.Printf("id:%d, body:%s\n", j.ID, string(j.Body))
		err = conn.Delete(j.ID)
		if err != nil {
			log.Fatal(err)
		}
	}
}

Implemented Commands

  • use
  • put
  • watch
  • ignore
  • reserve
  • delete
  • touch
  • release
  • bury
  • kick
  • kick-job
  • list-tubes
  • stats
  • stats-tube
  • stats-job
  • quit

Release Notes

Latest release is v0.3 that contains API changes, see release notes here

Author

gobeanstalk's People

Contributors

iwanbk avatar sb10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gobeanstalk's Issues

About yaml-parse

We now have stats, stats-job, stats-tube. which returns yaml strings.

But from a user perspective, we do not want to deal with yaml. We want data wraped in yaml, not yaml itself.

To achieve this, I have API modification related problem and Implementation-related problem

API modification related problem

Which one looks good to you?

  1. provides a new api, which returns a dict.
parsed_item, err := beanstalkc_conn.StatsTube_Parsed("default")
  1. Modify the existing API definition.
    2a)
parsed_item, err := beanstalkc_conn.StatsTube("default", func(_ string) map[string]interface{} {
    panic("do something")
})

2b)

    parsed_item, err:= beanstalkc_conn.StatsTube("default")

Implementation-related problem

Which one looks good to you?

Of course. If you prefer 2a, we can leave this to users to decide.

  1. use https://github.com/kr/beanstalk/blob/master/parse.go
    This will not have any dependence introduced. and since kr used that, It shall looks good to us.

  2. use https://github.com/go-yaml/yaml
    A huge but seems well-tested library

Tag a 0.2 release?

I'm using gpm to manage my go dependencies and need the Quit command which isn't in the 0.1 release. Would you please tag a new one? Thanks!

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.