concrete implementation choices for plz service
server
func sayHello(ctx *countlog.Context, req *MyReqeust) (*MyResponse, error) {
// ...
}
server := http.NewServer()
server.Handle("/sayHello", sayHello)
server.Start("127.0.0.1:9998")
client
var sayHello = func (ctx *countlog.Context, req *MyReqeust) (*MyResponse, error)
client := http.NewClient()
client.Handle("POST", "http://127.0.0.1:9998/sayHello", &sayHello)
// use sayHello(...) to call server
server
func sayHello(ctx *countlog.Context, req *MyReqeust) (*MyResponse, error) {
// ...
}
server := thrift.NewServer(thrifter.Config{Protocol: thrifter.ProtocolBinary, IsFramed: true}.Froze())
server.Handle("sayHello", sayHello)
server.Start("127.0.0.1:9998")
client
var sayHello = func (ctx *countlog.Context, req *MyReqeust) (*MyResponse, error)
client := thrift.NewClient(thrifter.Config{Protocol: thrifter.ProtocolBinary, IsFramed: true}.Froze())
client.Handle("127.0.0.1:9998", "sayHello", &sayHello)
// use sayHello(...) to call server