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.
Implement service stub
From the course: Building Java Microservices with gRPC
Implement service stub
- [Instructor] Now that we have the entire database code set up, the connection, the query, everything, let's move on to the service implementation. So let's go to the IDE. So this was our DB code. Now let's recollect that we have generated the stubs and those stubs sit in the target folder. And under that, we have the service class which is UserServiceGrpc. That is the class now that we want to extend and implement the method of get user details. So let's do that next. Let's close this and let's basically close all of these files. Let's add a package here. This will be com.shopping.service and let's add a class which is UserService and since it is the implementation of the stub, I'll call it, impl. Now this class should basically extend the User service grpc. This is the wrong import. In case you're not able to see that class, you just have to go to the Maven tab, refresh the project once more to make sure…
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)
Overview of order management services built in the course4m 51s
-
(Locked)
Create a maven-gRPC project4m 21s
-
(Locked)
Define user.proto and generate service stubs4m 42s
-
(Locked)
Database code setup4m 27s
-
(Locked)
Add database method to get user details7m 37s
-
(Locked)
Implement service stub7m 30s
-
(Locked)
Write code to host the user service8m 55s
-
(Locked)
Test the user service6m 13s
-
(Locked)
-
-