abstract class StandaloneLagomClientFactory extends LagomClientFactory
Convenience for constructing service clients in a non Lagom server application.
A StandaloneLagomClientFactory should be used only if your application does NOT have its own akka.actor.ActorSystem, in which this standalone factory will create and manage an akka.actor.ActorSystem and Akka Streams akka.stream.Materializer.
It is important to invoke StandaloneLagomClientFactory#stop() when the application is no longer needed, as this will trigger the shutdown of the underlying akka.actor.ActorSystem and Akka Streams akka.stream.Materializer releasing all thread and connection pools in use by the clients.
There is one more component that you’ll need to provide when creating a client application, 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 application built using the static service locator, which uses a static URI:
import java.net.URI import com.lightbend.lagom.scaladsl.client._ import play.api.libs.ws.ahc.AhcWSComponents val clientApplication = new StandaloneLagomClientFactory("my-client") with StaticServiceLocatorComponents with AhcWSComponents { override def staticServiceUri = URI.create("http://localhost:8080") }
- Source
- ServiceClient.scala
- Alphabetic
- By Inheritance
- StandaloneLagomClientFactory
- LagomClientFactory
- LagomConfigComponent
- LagomServiceClientComponents
- TopicFactoryProvider
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
StandaloneLagomClientFactory(clientName: String, classLoader: ClassLoader = ...)
- clientName
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.
- classLoader
A classloader, it will be used to create the service proxy and needs to have the API for the client in it.
Abstract Value Members
-
abstract
def
serviceLocator: ServiceLocator
- Definition Classes
- LagomServiceClientComponents
-
abstract
def
wsClient: WSClient
- Definition Classes
- LagomServiceClientComponents
Concrete Value Members
-
lazy val
actorSystem: ActorSystem
- Definition Classes
- StandaloneLagomClientFactory → LagomServiceClientComponents
-
lazy val
applicationLifecycle: ApplicationLifecycle
- Definition Classes
- LagomClientFactory → LagomServiceClientComponents
-
lazy val
circuitBreakerMetricsProvider: CircuitBreakerMetricsProvider
- Definition Classes
- LagomServiceClientComponents
-
def
config: Config
- Definition Classes
- LagomConfigComponent
-
lazy val
configuration: Configuration
- Definition Classes
- LagomClientFactory → LagomConfigComponent
- lazy val coordinatedShutdown: CoordinatedShutdown
-
lazy val
defaultExceptionSerializer: ExceptionSerializer
- Definition Classes
- LagomServiceClientComponents
-
lazy val
environment: Environment
- Definition Classes
- LagomClientFactory → LagomServiceClientComponents
-
lazy val
executionContext: ExecutionContext
- Definition Classes
- LagomClientFactory → LagomServiceClientComponents
-
lazy val
materializer: Materializer
- Definition Classes
- StandaloneLagomClientFactory → LagomServiceClientComponents
-
def
optionalTopicFactory: Option[TopicFactory]
- Definition Classes
- TopicFactoryProvider
-
lazy val
scaladslWebSocketClient: ScaladslWebSocketClient
- Definition Classes
- LagomServiceClientComponents
-
lazy val
serviceClient: ServiceClient
- Definition Classes
- LagomServiceClientComponents
-
lazy val
serviceInfo: ServiceInfo
- Definition Classes
- LagomClientFactory → LagomServiceClientComponents
-
lazy val
serviceResolver: ServiceResolver
- Definition Classes
- LagomServiceClientComponents
-
def
stop(): Unit
Stop this LagomClientFactory by shutting down the internal akka.actor.ActorSystem, Akka Streams akka.stream.Materializer and internal resources.
Stop this LagomClientFactory by shutting down the internal akka.actor.ActorSystem, Akka Streams akka.stream.Materializer and internal resources.
- Definition Classes
- StandaloneLagomClientFactory → LagomClientFactory
-
def
topicPublisherName: Option[String]
The name of the topic publisher.
The name of the topic publisher.
Since topic publishers don't actually provide any components, they just consume a LagomServer and publish the topics they find there, this can be used to signal that a topic publisher has been provided to publish topics, so that the LagomServerComponents can detect a misconfiguration where one hasn't been provided.
- returns
The name of the topic publisher that has published topics, if one has been provided.
- Definition Classes
- TopicFactoryProvider