2 Star 1 Fork 2

Beta版厨子3.0® / kiteq-client-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

kiteq-client-go

kiteq-client-go is kiteq's go client

工程结构

kiteq/
├── README.md
├── log               log4go的配置
├── benchmark         KiteQ的Benchmark程序
├── client            KiteQ的客户端
启动客户端:
        对于KiteQClient需要实现消息监听器,我们定义了如下的接口:
        type IListener interface {
            //接受投递消息的回调
            OnMessage(msg *protocol.StringMessage) bool
            //接收事务回调
            // 除非明确提交成功、其余都为不成功
            // 有异常或者返回值为false均为不提交
            OnMessageCheck(tx *protocol.TxResponse) error
        }

    启动Producer :
        producer := client.NewKiteQClient(${zkhost}, ${groupId}, ${password}, &defualtListener{})
        producer.SetTopics([]string{"trade"})
        producer.Start()
        //构建消息
        msg := &protocol.StringMessage{}
        msg.Header = &protocol.Header{
            MessageId:     proto.String(client.MessageId()),
            Topic:         proto.String("trade"),
            MessageType:   proto.String("pay-succ"),
            ExpiredTime:   proto.Int64(time.Now().Unix()),
            DeliveryLimit: proto.Int32(-1),
            GroupId:       proto.String("go-kite-test"),
            Commit:        proto.Bool(true)}
        msg.Body = proto.String("echo")
        //发送消息
        producer.SendStringMessage(msg)

    启动Consumer:
        consumer:= client.NewKiteQClient(${zkhost}, ${groupId}, ${password}, &defualtListener{})
        consumer.SetBindings([]*binding.Binding{
            binding.Bind_Direct("s-mts-test", "trade", "pay-succ", 1000, true),
        })
        consumer.Start()

Bingo 完成发布和订阅消息的功能了.....

  • 可以参考benchmark中使用

空文件

简介

kiteq-client-go is kiteq's go client 展开 收起
Go
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/blackbeans/kiteq-client-go.git
git@gitee.com:blackbeans/kiteq-client-go.git
blackbeans
kiteq-client-go
kiteq-client-go
master

搜索帮助

14c37bed 8189591 565d56ea 8189591