A Lagom application.
The Lagom application context.
The Lagom application context.
This wraps a Play context, but is provided such that if in future Lagom needs to pass other context information to an app, this can be extended without breaking compatibility.
A Play application loader for Lagom.
A Play application loader for Lagom.
Scala Lagom applications should provide a subclass of this to create their application, and configure it in their
application.conf
file using:
play.application.loader = com.example.MyApplicationLoader
This class provides an abstraction over Play's application loader that provides Lagom specific functionality.
A Lagom server
Internal API used by AST generated by the serverFor macro.
Internal API used by AST generated by the serverFor macro.
A Lagom service router.
A Lagom service router.
This trait doesn't add anything, except that it makes the router created by the LagomServer strongly typed. This allows it to be dependency injected by type, making it simple to use it in combination with the Play routes file.
For example, if using a custom router, the Lagom router could be routed to from the routes file like this:
-> / com.lightbend.lagom.scaladsl.server.LagomServiceRouter
A service locator that just resolves locally provided services.
A service locator that just resolves locally provided services.
This is useful for integration testing a single service, and can be mixed in to a LagomApplication class to provide the local service locator.
A service call implementation that allows plugging directly into Play's request handling.
When using dynamic port allocation, a circular dependency may exist if the application needs to know what port it's running on, since the port won't be know until after the server has bound to the listening port (the OS will select a free port at bind time), but we can't bind the server to the listening port until we have an application to service incoming requests.
When using dynamic port allocation, a circular dependency may exist if the application needs to know what port it's running on, since the port won't be know until after the server has bound to the listening port (the OS will select a free port at bind time), but we can't bind the server to the listening port until we have an application to service incoming requests.
This trait allows that circular dependency to be resolved, by making the port available as a future, and allowing it to be provided after the application has been created using the RequiresLagomServicePort.provideLagomServicePort() method.
This is primarily useful for testing, where dynamic port allocation is often used.
A server implementation of a service call.
A server implementation of a service call.
While the server implementation of the service doesn't have to make use of this type, what this type does is it allows the supply and composition of request and response headers. When working with and or composing server service calls, it is almost never a good idea to call #invoke(Object), rather, Object) should be called. Invocation of the former may result in an UnsupportedOperationException being thrown.
In some cases, where the underlying transport doesn't allow sending a header after the request message has been received (eg WebSockets), the response header may be ignored. In these cases, Lagom will make a best effort attempt at determining whether there was custom information in the response header, and if so, log a warning that it wasn't set.
Internal API used by AST generated by the serverFor macro.
A Lagom application.
A Lagom service should subclass this in order to wire together a Lagom application.
This includes the Lagom server components (which builds and provides the Lagom router) as well as the Lagom service client components (which allows implementing Lagom service clients from Lagom service descriptors).
There are two abstract defs that must be implemented, one is LagomServerComponents.lagomServer, the other is LagomServiceClientComponents.serviceLocator. Typically, the
lagomServer
component will be implemented by an abstract subclass of this class, and will bind all the services that this Lagom application provides. Meanwhile, theserviceLocator
component will be provided by mixing in a service locator components trait in LagomApplicationLoader, which trait is mixed in will vary depending on whether the application is being loaded for production or for development.