The name of the service that is consuming the Lagom service. This will impact how calls made through clients generated by this factory will identify themselves.
A classloader, it will be used to create the service proxy and needs to have the API for the client in it.
Releases the internal resources manages by this LagomClientFactory.
Releases the internal resources manages by this LagomClientFactory.
Override this method if your LagomClientFactory implementation needs to free any resource.
Override this method if your LagomClientFactory implementation needs to free any resource.
For example, when implementing your own LagomClientFactory, you may choose to reuse an existing akka.actor.ActorSystem, but use a internal akka.stream.Materializer. In which case, you can use this method to only shutdown the akka.stream.Materializer.
If you override this method, make sure you also release the internally managed resources by calling #releaseInternalResources() method.
Convenience for constructing service clients in a non Lagom server application.
LagomClientFactory should be used only if your application DO have its own akka.actor.ActorSystem and Akka Streams akka.stream.Materializer, in which case you should reuse then when building a LagomClientFactory.
The easiest way to reuse your existing akka.actor.ActorSystem and Akka Stream akka.stream.Materializer is to extend the LagomClientFactory and add a constructor where you can pass them as arguments (see example below).
There is one more component that you’ll need to provide when creating a LagomClientFactory, that is a service locator. It is up to you what service locator you use, it could be a third party service locator, or a service locator created from static configuration.
Lagom provides a number of built-in service locators, including a StaticServiceLocator, a RoundRobinServiceLocator and a ConfigurationServiceLocator. The easiest way to use these is to mix in their respective Components traits.
For example, here’s a client factory built using the static service locator, which uses a static URI, and reusing an akka.actor.ActorSystem and Akka Streams akka.stream.Materializer created outside it: