jxplus commented on issue #6797:
URL: https://github.com/apache/dubbo/issues/6797#issuecomment-1123394458

   jdk:1.8
   dubbo:2.7.15
   协议:grpc
   
   写了个列表查询接口,
   provider端实现:
   `    public void list(SearchUserRequest request, 
StreamObserver<UserResponse> responseObserver) {
           users.forEach(c -> {
               UserResponse ur = 
               
UserResponse.newBuilder().setId(c.getId()).setName(c.getName()).build();
               responseObserver.onNext(ur);
           });
           responseObserver.onCompleted();
       }`
   consumer端调用:
   `SearchUserRequest request = SearchUserRequest.newBuilder().build();
           Iterator<UserResponse> responseIterator = userService.list(request);
           responseIterator.forEachRemaining(item -> {
               String str = String.format("user[id=%d, name=%s, address=%s]", 
item.getId(), item.getName(), item.getAddress());
               System.out.println(str);
           });`
   先启动provider,然后再起consumer,有时正常,有时还是报这个错,求解。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to