2015-01-13 23:31:27 +00:00
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
2015-01-31 16:49:21 +01:00
|
|
|
log "github.com/golang/glog"
|
2015-05-23 11:53:40 +01:00
|
|
|
c "github.com/myodc/go-micro/context"
|
2015-05-25 18:16:42 +01:00
|
|
|
example "github.com/myodc/go-micro/examples/server/proto/example"
|
2015-05-05 19:05:06 +01:00
|
|
|
"github.com/myodc/go-micro/server"
|
2015-05-23 11:53:40 +01:00
|
|
|
|
|
|
|
"golang.org/x/net/context"
|
2015-01-13 23:31:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Example struct{}
|
|
|
|
|
|
|
|
func (e *Example) Call(ctx context.Context, req *example.Request, rsp *example.Response) error {
|
2015-05-26 22:39:48 +01:00
|
|
|
md, _ := c.GetMetadata(ctx)
|
2015-05-25 18:16:42 +01:00
|
|
|
log.Info("Received Example.Call request with metadata: %v", md)
|
2015-05-26 22:39:48 +01:00
|
|
|
rsp.Msg = server.Config().Id() + ": Hello " + req.Name
|
2015-01-13 23:31:27 +00:00
|
|
|
return nil
|
|
|
|
}
|