What is the simplest way to consume an external REST service in Lagom?
A way to consume 3rd party REST services from lagom is by writing the 3rd party's REST spec using a Lagom Descriptor
.
Imagine your code wanted to interact with Slack's API, you would create a slack-api
project in your app and create the Slack descriptor there (you wouldn't need to create a slack-impl
of course).
Then, on your fancy-impl
code you would depend on slack-api
and in your FancyServiceImpl
implementation you would inject SlackService
in the constructor.
PS: The gist is scala code, but same idea applies to Lagom's Java DSL.