Checkpoint the world

This commit is contained in:
Asim
2015-12-18 01:01:59 +00:00
parent 6ae48c9f29
commit 4cba0c57ab
7 changed files with 86 additions and 86 deletions

View File

@@ -56,9 +56,7 @@ func call(i int) {
func stream() {
// Create new request to service go.micro.srv.example, method Example.Call
req := client.NewRequest("go.micro.srv.example", "Example.Stream", &example.StreamingRequest{
Count: int64(10),
})
req := client.NewRequest("go.micro.srv.example", "Example.Stream", &example.StreamingRequest{})
stream, err := client.Stream(context.Background(), req)
if err != nil {
@@ -66,6 +64,15 @@ func stream() {
return
}
fmt.Println("sending request")
if err := stream.Send(&example.StreamingRequest{
Count: int64(10),
}); err != nil {
fmt.Println("err", err)
return
}
fmt.Println("sent request")
for stream.Error() == nil {
rsp := &example.StreamingResponse{}
err := stream.Recv(rsp)
@@ -88,14 +95,14 @@ func stream() {
func main() {
cmd.Init()
fmt.Println("\n--- Call example ---\n")
for i := 0; i < 10; i++ {
call(i)
}
// fmt.Println("\n--- Call example ---\n")
// for i := 0; i < 10; i++ {
// call(i)
// }
fmt.Println("\n--- Streamer example ---\n")
stream()
fmt.Println("\n--- Publisher example ---\n")
pub()
// fmt.Println("\n--- Publisher example ---\n")
// pub()
}