Defining services
When writing your project, you should adhere to best practices and standards. A service interface should always be placed in a *-api
project. You can see the HelloService
interface follows the same rule. The requirement is for your service interface to extend the Lagom service interface and provide a default implementation for the descriptor method. The descriptor is responsible for mapping the service to the underlying transport protocol.
public interface HelloService extends Service { ServiceCall<NotUsed, String> hello(String id); ServiceCall<GreetingMessage, Done> useGreeting(String id); @Override default Descriptor descriptor() { return named("hello").withCalls( pathCall("/api/hello/:id", this::hello), pathCall("/api/hello/:id", this::useGreeting) ).withAutoAcl(true); } }
This is quite a simple description of a service exposing two service...