gobeanstalk 基于 Go 的 beanstalkd 客户端开源项目

我要开发同款
匿名用户2016年09月12日
83阅读

技术信息

开源地址
https://github.com/liuzhengyang/gobeanstalk
授权协议
GPL

作品详情

go-beastalk是beastalkd 的GO语言的一个客户端.

项目还在开发中,欢迎大家提意见

介绍

beastalkd是一个快速的、有各种用途的延迟队列和定时任务的不同点:定时任务以一定的周期或者在某个特定的时间运行。beastalk可以在延迟一段时间执行。一些使用场景:

用户下单5分钟后检查用户是否完成了支付一分钟后开始一个新的程序

如何使用

Mac&Liux

安装并启动beatalkd服务器

gitcloehttps://github.com/kr/beastalkdcdbeastalkdmake./beastalkd

使用示例

gogetgithub.com/liuzhegyag/gobeastalk

createatest.gofile

packagemaiimport("fmt""github.com/liuzhegyag/gobeastalk")fucmai(){addr:="localhost:11300"//defieserveraddressewCo:=gobeastalk.NewCoectio(addr)//createewcoectiochael:=make(chait)//createitchaelputFuc:=fuc(){//defieafuctiowhichputsomemessagetooetubeid,_:=ewCo.PutWithTube("hello","test2",1)chael<-id}goputFuc()//rupreviousfuctioiago-routieid:=<-chael//waitutilwefiishputtigfmt.Pritf("Receivefromchaelmessageofaothergoroutie%d\",id)listeChael:=make(chastrig)//makealistechaelforreceivigresultsdealFuc:=fuc(bodystrig)bool{//defieafuctiotodealwithtubemessagesfmt.Pritf("receive%s\",body)listeChael<-bodyreturtrue}goewCo.Liste("test2",dealFuc)//rudealfuctioiaspecifiedgo-routigbody:=<-listeChael//waitourmessagefmt.Pritf("Listeoce%s\",body)ewCo.Close()//Closecoectio}

Adruthis

gorutest.go

功能介绍

go-beanstalk 是beanstalkd 的GO语言的一个客户端. 项目还在开发中,欢迎大家提意见 介绍 beanstalkd是一个快速的、有各种用途的延迟队列 和定时任务的不同点: 定...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论