From the course: Building Java Microservices with gRPC
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Add service method to get order details
From the course: Building Java Microservices with gRPC
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Define order.proto and generate stubs6m 10s
-
(Locked)
Add database method to get orders8m 17s
-
(Locked)
Add service method to get order details6m 47s
-
(Locked)
Write code to host order service3m 48s
-
(Locked)
Test the order service using the client2m 57s
-
(Locked)
Recap to connect user and order services1m 50s
-
(Locked)
Write a client to call order service5m 14s
-
(Locked)
Call order client from user service7m 44s
-
(Locked)
Test the full flow of order management6m 43s
-
(Locked)
Challenge: Implement add-to-cart use case1m 33s
-
(Locked)
-