How it works...
In this recipe, we covered how service consumption from another service is done within a Lagom service. To demonstrate this behavior, we have created a new service named consumer. To start, we create the API and implementation modules in build.sbt. The consumer service will be using the token service, which is why we add the token-api module as a dependency in the implementation module (consumer-impl). Once that is ready, we develop our API module. This service takes ConsumeRequest and returns a Boolean. The desired behavior is to use the token service when the consumer service receives a request and return true if the token is valid and false if it's not.
In order to use the token service in ConsumerServiceImpl, we just add ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access