Hprose based on NATs message queue
- timeout
- lazy load
- failround
- load balancing
go get github.com/vlorc/hprose-go-nats
This project is under the apache License. See the LICENSE file for the full license text.
client := rpc.NewClient("nats://localhost:4222?topic=test&timeout=1")
method := &struct{ Hello func(string) (string, error) }{}
client.UseService(method)
for i := 0; i < 10; i++ {
log.Print(method.Hello(fmt.Sprintf("baby(%d)",i)))
}
server := rpc.NewServer(rpc.NewOption(rpc.Uri("nats://localhost:4222?topic=test&group=balancer")))
server.AddFunction("hello", func(msg string) string {
log.Print("hello: ", msg)
return "hi bitch!"
})
server.Start()