package client

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait CircuitBreakerComponents extends LagomConfigComponent

    Components required for circuit breakers.

  2. trait CircuitBreakersPanel extends AnyRef

    A CircuitBreakersPanel is a central point collecting all circuit breakers in Lagom.

    A CircuitBreakersPanel is a central point collecting all circuit breakers in Lagom.

    Calls to remote services can make use of this facility in order to add circuit breaking capabilities to it.

  3. abstract class CircuitBreakingServiceLocator extends ServiceLocator

    Abstract service locator that provides circuit breaking.

    Abstract service locator that provides circuit breaking.

    Generally, only the ServiceLocator.locate() method needs to be implemented, however doWithServiceImpl() can be overridden if the service locator wants to handle failures in some way.

  4. class ConfigurationServiceLocator extends CircuitBreakingServiceLocator

    A service locator that uses static configuration.

  5. trait ConfigurationServiceLocatorComponents extends CircuitBreakerComponents

    Components for using the configuration service locator.

  6. abstract class LagomClientFactory extends LagomServiceClientComponents with LagomConfigComponent

    Convenience for constructing service clients in a non Lagom server application.

    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:

    import java.net.URI
    import com.lightbend.lagom.scaladsl.client._
    import play.api.libs.ws.ahc.AhcWSComponents
    
    class MyLagomClientFactory(val actorSystem: ActorSystem, val materializer: Materializer)
      extends LagomClientFactory("my-client")
      with StaticServiceLocatorComponents
      with AhcWSComponents {
    
      override def staticServiceUri = URI.create("http://localhost:8080")
    }
    
    
    val actorSystem = ActorSystem("my-app")
    val materializer = SystemMaterializer(actorSystem).materializer
    val clientFactory = new MyLagomClientFactory(actorSystem, materializer)
  7. trait LagomServiceClientComponents extends TopicFactoryProvider

    The Lagom service client components.

  8. class RoundRobinServiceLocator extends CircuitBreakingServiceLocator

    A round robin service locator, that cycles through a list of URIs.

  9. trait RoundRobinServiceLocatorComponents extends CircuitBreakerComponents

    Components for using the round robin service locator.

  10. trait ServiceClient extends AnyRef

    The Lagom service client implementor.

    The Lagom service client implementor.

    Instances of this must also implement ServiceClientConstructor, so that the implementClient macro can generate code that constructs the service client.

  11. trait ServiceClientConstructor extends ServiceClient

    Lagom service client constructor.

    Lagom service client constructor.

    This API should not be used directly, it will be invoked by the client generated by ServiceClient.implement in order to construct the client and obtain the dependencies necessary for the client to operate.

    The reason for a separation between this interface and ServiceClient is so that the #construct method doesn't appear on the user facing ServiceClient API. The macro it generates will cast the ServiceClient to a ServiceClientConstructor in order to invoke it.

    Although this API should not directly be used by end users, the code generated by the ServiceClient macro does cause end users to have a binary dependency on this class, which is why it's in the scaladsl package.

  12. trait ServiceClientContext extends AnyRef

    The service client context.

    The service client context.

    This API should not be used directly, it will be invoked by the client generated by ServiceClient.implement in order to implement each service call and topic.

    The service client context is essentially a map of service calls and topics, constructed from a service descriptor, that allows a ServiceCall to be easily constructed by the services methods.

    Although this API should not directly be used by end users, the code generated by the ServiceClient macro does cause end users to have a binary dependency on this class, which is why it's in the scaladsl package.

  13. trait ServiceClientImplementationContext extends AnyRef

    The service client implementation context.

    The service client implementation context.

    This API should not be used directly, it will be invoked by the client generated by ServiceClient.implement in order to resolve the service descriptor.

    The purpose of this API is to capture the dependencies required in order to implement a service client, such as the HTTP and WebSocket clients.

    Although this API should not directly be used by end users, the code generated by the ServiceClient macro does cause end users to have a binary dependency on this class, which is why it's in the scaladsl package.

  14. trait ServiceResolver extends AnyRef
  15. abstract class StandaloneLagomClientFactory extends LagomClientFactory

    Convenience for constructing service clients in a non Lagom server application.

    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")
    }
  16. class StaticServiceLocator extends CircuitBreakingServiceLocator

    A static service locator, that always resolves the same URI.

  17. trait StaticServiceLocatorComponents extends CircuitBreakerComponents

    Components for using the static service locator.

  18. abstract class LagomClientApplication extends StandaloneLagomClientFactory

    Convenience for constructing service clients in a non Lagom server application.

    Convenience for constructing service clients in a non Lagom server application.

    It is important to invoke #stop when the application is no longer needed, as this will trigger the shutdown of all thread and connection pools.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.4.9) Use StandaloneLagomClientFactory instead

Value Members

  1. object ClientStoppedReason extends Reason with Product with Serializable

Ungrouped