experimental codec branch

This commit is contained in:
Asim
2015-11-27 00:17:36 +00:00
parent dc5f121c64
commit f49922f6b3
10 changed files with 183 additions and 57 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/codec/pb"
c "github.com/micro/go-micro/context"
example "github.com/micro/go-micro/examples/server/proto/example"
"golang.org/x/net/context"
@@ -119,6 +120,12 @@ func stream() {
func main() {
cmd.Init()
client.DefaultClient = client.NewClient(
client.Codec("application/pb", pb.Codec),
client.ContentType("application/pb"),
)
fmt.Println("\n--- Call example ---\n")
for i := 0; i < 10; i++ {
call(i)

View File

@@ -3,6 +3,7 @@ package main
import (
log "github.com/golang/glog"
"github.com/micro/go-micro/cmd"
"github.com/micro/go-micro/codec/bson"
"github.com/micro/go-micro/examples/server/handler"
"github.com/micro/go-micro/examples/server/subscriber"
"github.com/micro/go-micro/server"
@@ -12,11 +13,16 @@ func main() {
// optionally setup command line usage
cmd.Init()
server.DefaultServer = server.NewServer(
server.Codec("application/bson", bson.Codec),
)
// Initialise Server
server.Init(
server.Name("go.micro.srv.example"),
)
// Register Handlers
server.Handle(
server.NewHandler(