Writing an API interface
In this section, we will write the API interface using the protocol buffer (Protobuf) for payment service. If you recall, this is the piece that you haven't yet implemented the sample e-commerce app.
Before writing the API interface, let's set up the Gradle project first.
Setting up the project
The code for this chapter will contain three projects under the Chapter11
directory – API, server, and client:
- API: This is a library project that contains the
.proto
file and its generated Java classes packaged in a jar file. You will publish thelibrary payment-gateway-api-0.0.1.jar
file locally. This library will then be used in both server and client projects. - Server: This project contains the gRPC server that will implement the gRPC services and serve the gRPC requests.
- Client: This project contains the gRPC client that will call the gRPC server. You are going to implement a REST call that will call the gRPC server internally...