From the course: Building Java Microservices with gRPC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add service method to get order details

Add service method to get order details

From the course: Building Java Microservices with gRPC

Start my 1-month free trial

Add service method to get order details

- [Instructor] The next step will be to write the OrderSeviceImpl class, that's the server stub implementation. And that is going to take the data from the database and convert it into proto objects. So let's go back to the IDE, and I will add a new class in the service package, which is the OrderSeviceImpl. And this as usual, we'll extend the OrderServiceGrpcs in a class, which is the ImplBase. And on line seven, I will just type in the name of the method that I have to implement. That is getOrdersForUser. The arguments are the same that we saw when we were trying to implement the user service. So there's order request, and there's a stream observer for the order response. Let's eliminate line number 12, we don't need the super call. So what we're going to do, we are going to call this database method, get the list of orders and convert that list of domain object orders from a list of proto object orders. So…

Contents