From c0820b5e5c0f4ee46eb6918d509690a1921ccfc9 Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Wed, 28 Feb 2024 15:19:31 +0100 Subject: [PATCH] (docs) Update service docs --- code/common/service/readme.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/common/service/readme.md b/code/common/service/readme.md index 14abfb07..79d0a613 100644 --- a/code/common/service/readme.md +++ b/code/common/service/readme.md @@ -1,13 +1,17 @@ # Service Contains the base classes for the services. This is where port configuration, -and common endpoints are set up. +and common endpoints are set up. The service base class is additionally responsible for +registering the service with the service registry, and announcing its liveness. ## Creating a new Service The minimal service needs a `MainClass` and a `Service` class. -For proper initiation, the main class should look like this: +For proper initiation, the main class should look like the below. It will +create a Guice injector, and then create an instance of the service, and take +care of loading configuration properties and setting up loggers in a sane +way. ```java public class FoobarMain extends MainClass { @@ -41,12 +45,12 @@ public class FoobarService extends Service { public FoobarService(BaseServiceParams params) { super(params, List.of(/* grpc services */)); - // set up Spark endpoints here + // set up any Spark endpoints here } } ``` -Further the new service needs to be added to the `ServiceId` enum in [service-discovery](../service-discovery). +The service should also be given a canonical name in the `ServiceId` enum. ## Central Classes