...

/

Setting Up a gRPC Service

Setting Up a gRPC Service

Walk through the boilerplate code required to set up a gRPC service defined in the .proto file.

Configuration files

In this lesson, we will define the boilerplate code for the FTP service. Before we define the class containing the service implementation, we will define the configuration properties for the server. We will create a file config.properties in the src/main/resources directory. You can find the file, along with its explanation, in the Server and Client Configuration Properties lesson. We will also add configuration properties for the logger in a file named log4j2.properties in the src/main/resources directory. Details of this file can be found in Configuring the Logger lesson. Both files are shown below:

config.properties
log4j2.properties
DESTINATION_DIRECTORY_ON_SERVER=/Users/IdeaProjects/grpc-ftp-project/destOnServer/
TEMP_WRITE_PATH=/Users/IdeaProjects/grpc-ftp-project/destOnServer/tmp
Config files for server and logger configuration

After defining the configuration file, we will create a class called ServerConfiguration in the utils package inside src/main/java/io/datajek/ftpservice. This class loads the contents of the configuration file. You can ...