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.
Define user.proto and generate service stubs
From the course: Building Java Microservices with gRPC
Define user.proto and generate service stubs
- [Instructor] The next step will be to build the service definition file which is the user.proto. So let's go back to the IDE and first I'll create a folder here under the main, label that as proto and make sure you mark this directory as a source folder. And under this, I'll create a file, which is user.proto. So let's go ahead and define the user service. The first statement will of course be the syntax. So that will be proto3. The next will be the packet statement. So let's give this a proper name, we'll call it com.shopping.stubs.user. We'll additionally also define the java_package to explicitly state the Java package. And I'm going to keep that exactly same as the one that we defined on line number three. So let's copy this and let's provide that as a value. Also, let's make sure that java_multiple_files is set to true. The next step is to define the service. So we'll say service, give a name, user service.…
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
-
-
-
-
-
Overview of order management services built in the course4m 51s
-
Create a maven-gRPC project4m 21s
-
Define user.proto and generate service stubs4m 42s
-
Database code setup4m 27s
-
Add database method to get user details7m 37s
-
Implement service stub7m 30s
-
Write code to host the user service8m 55s
-
Test the user service6m 13s
-
-
-