Go-MOA RPC 框架

程序名称:Go-MOA

授权协议: 未知

操作系统: 跨平台

开发语言: Google Go

Go-MOA 介绍

Go-MOA 是使用redis get请求协议的RPC 框架。

  • 安装:

安装ZooKeeper $Zookeeper/bin/zkServer.sh start

    go get  github.com/blackbeans/go-moa/core
go get  github.com/blackbeans/go-moa/proxy
  • 定义服务的接口对应

        //接口
    

    type DemoResult struct {
            Hosts []string json:"hosts"
            Uri   string   json:"uri"
        }

    type IGoMoaDemo interface {
            GetDemoName(serviceUri, proto string) (DemoResult, error)
        }
        //服务实现
        type GoMoaDemo struct {
        }

    func (self GoMoaDemo) GetDemoName(serviceUri, proto string) (DemoResult, error)      {
            return DemoResult{[]string{“fuck gfw”}, serviceUri}, nil
        }

    • 例如接口为:
  • 服务端启动启动:

        func main(){
    

    app := core.NewApplcation(“./conf/cluster_test.toml”, 
            func() []proxy.Service {
                return []proxy.Service{
                    proxy.Service{
                        ServiceUri: ”/service/bibi/go-moa”,
                        Instance:   GoMoaDemo{},
                        Interface:  (*IGoMoaDemo)(nil)}}
            })

    //设置启动项
            ch := make(chan os.Signal, 1)
            signal.Notify(ch, os.Kill)
            //kill掉的server
            <-ch
            app.DestoryApplication()
        }

  • 说明

    • Service为一个服务单元,对应了本服务对外的服务名称、以及对应的接口

    • Applcation需要对应的Moa的配置文件,toml类型,具体配置参见./conf/cluster_test.toml

  • 发布服务成功可以使用客户端进行测试,具体客户端的使用请参考

*** Benchmark

env:Macbook Pro 2.2 GHz Intel Core i7

go test --bench=".*" github.com/blackbeans/go-moa/core -run=BenchmarkApplication

BenchmarkApplication-8     20000         64517 ns/op

Go-MOA 官网

https://github.com/blackbeans/go-moa

相关编程语言

MuPlayer 是一款跨平台、轻量级的音频播放解决方案,...
OS FLV 是一个 开源和可嵌入网页的flv播放器。 这个...
DewPlayer音乐播放器,样式很简单,而且很实用.播放器...
JW FLV MEDIA PLAYER是一个开源的在网页上使用的Fla...
Speakker 是一个基于 Web 浏览器的音乐播放器,只提...
Player Framework 是一个开源的支持 HTML5 的视频播...