simplesteph / grpc-java-course Goto Github PK
View Code? Open in Web Editor NEWCompanion Repository for my gRPC Java course
Home Page: http://bit.ly/grpc-java-github
Companion Repository for my gRPC Java course
Home Page: http://bit.ly/grpc-java-github
There is a method, which returns stream response of Blog:
public java.util.Iterator<com.proto.blog.ListBlogResponse> listBlog(
com.proto.blog.ListBlogRequest request) {
return blockingServerStreamingCall(
getChannel(), getListBlogMethod(), getCallOptions(), request);
}
To print each blog one be one:
blogClient.listBlog(ListBlogRequest.newBuilder().build()).forEachRemaining(
listBlogResponse -> System.out.println(listBlogResponse.getBlog().toString())
);
But if it's needed on client to wait until getting all blogs and having it as com.proto.blog.ListBlogResponse
, what's the best option to do?
@simplesteph , could you please help
Hello Stephane, I'm taking your course right now, and during it just found the approach you use, which in my opinion could be improved.
I understand that the course is not about "good practices" or "java coding", but since the students could refer to this code, it makes sense to use best practices.
In this case, ObjectId has a static method #isValid, and we can make this check (with returning INVALID_ARGUMENT status) instead of naive try-catch.
after downloading the github project error on import com.proto.blog.*
/home/jr/Documents/Projetos/grpc-java-course/build/generated/source/proto/main/grpc/com/proto/blog/BlogServiceGrpc.java:20: error: cannot find symbol
@javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
Do you know why I'm getting this error?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.