switchup init
This commit is contained in:
parent
4cba0c57ab
commit
a5be9ca585
@ -136,23 +136,14 @@ func (r *rpcClient) stream(ctx context.Context, address string, req Request) (St
|
|||||||
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
|
return nil, errors.InternalServerError("go.micro.client", fmt.Sprintf("Error sending request: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
codec := newRpcPlusCodec(msg, c, cf)
|
stream := &rpcStream{
|
||||||
|
|
||||||
err = codec.WriteRequest(&request{
|
|
||||||
Service: req.Service(),
|
|
||||||
ServiceMethod: req.Method(),
|
|
||||||
Seq: 0,
|
|
||||||
}, req.Request())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.InternalServerError("go.micro.client", err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return &rpcStream{
|
|
||||||
context: ctx,
|
context: ctx,
|
||||||
request: req,
|
request: req,
|
||||||
codec: codec,
|
codec: newRpcPlusCodec(msg, c, cf),
|
||||||
}, nil
|
}
|
||||||
|
|
||||||
|
err = stream.Send(req.Request())
|
||||||
|
return stream, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *rpcClient) CallRemote(ctx context.Context, address string, request Request, response interface{}, opts ...CallOption) error {
|
func (r *rpcClient) CallRemote(ctx context.Context, address string, request Request, response interface{}, opts ...CallOption) error {
|
||||||
|
@ -64,20 +64,11 @@ func stream() {
|
|||||||
return
|
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 {
|
for stream.Error() == nil {
|
||||||
rsp := &example.StreamingResponse{}
|
rsp := &example.StreamingResponse{}
|
||||||
err := stream.Recv(rsp)
|
err := stream.Recv(rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println("recv err", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
fmt.Println("Stream: rsp:", rsp.Count)
|
fmt.Println("Stream: rsp:", rsp.Count)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user