public interface ServiceGuiceSupport extends ServiceClientGuiceSupport
Implementors of this interface must invoke bindService(java.lang.Class<T>, java.lang.Class<? extends T>), bindServices(ServiceBinding[]) or bindServiceInfo(ServiceInfo) exactly-once depending on the type of Lagom
service being implemented (1 service, many services, consume-only). These methods setup the
service and may transparently add cross-cutting services like MetricsService (allows
monitoring circuit-breakers from the outside).
| Modifier and Type | Interface and Description |
|---|---|
static class |
ServiceGuiceSupport.ClassServiceBinding<T> |
static class |
ServiceGuiceSupport.InstanceServiceBinding<T> |
static class |
ServiceGuiceSupport.ServiceBinding<T> |
| Modifier and Type | Method and Description |
|---|---|
default <T extends Service> |
bindService(Class<T> serviceInterface,
Class<? extends T> serviceImplementation)
Binds a Service interface with its implementation.
|
default <T extends Service> |
bindService(Class<T> serviceInterface,
T service)
Binds a Service interface with an instance that implements it.
|
default void |
bindServiceInfo(ServiceInfo serviceInfo)
Creates a custom
ServiceInfo for this Lagom service. |
default void |
bindServices(ServiceGuiceSupport.ServiceBinding<?>... serviceBindings)
Deprecated.
support for multiple locatable ServiceDescriptors per Lagom service will be
removed. Use
bindService(java.lang.Class<T>, java.lang.Class<? extends T>) instead |
default <T> ServiceGuiceSupport.ServiceBinding<T> |
serviceBinding(Class<T> serviceInterface,
Class<? extends T> serviceImplementation)
Convenience method to create
ServiceGuiceSupport.ServiceBinding when using bindServices(ServiceBinding[]). |
default <T> ServiceGuiceSupport.ServiceBinding<T> |
serviceBinding(Class<T> serviceInterface,
T service)
Convenience method to create
ServiceGuiceSupport.ServiceBinding when using bindServices(ServiceBinding[]). |
bindClientdefault void bindServiceInfo(ServiceInfo serviceInfo)
ServiceInfo for this Lagom service. This method overrides ServiceClientGuiceSupport.bindServiceInfo(ServiceInfo) with custom behavior for consume-only
Lagom services.bindServiceInfo in interface ServiceClientGuiceSupportserviceInfo - the metadata identifying this Lagom Service.default void bindServices(ServiceGuiceSupport.ServiceBinding<?>... serviceBindings)
bindService(java.lang.Class<T>, java.lang.Class<? extends T>) insteadInspects all bindings and creates routes to serve every call described in the bound services.
Builds the ServiceInfo metadata using only the locatable services.
serviceBindings - an arbitrary list of ServiceGuiceSupport.ServiceBindings. Use the convenience method
serviceBinding(Class, Class) to build the ServiceGuiceSupport.ServiceBindings. Despite being a varargs argument, it is required to provide
at least one ServiceGuiceSupport.ServiceBinding as argument.default <T extends Service> void bindService(Class<T> serviceInterface, Class<? extends T> serviceImplementation)
Inspects the service descriptor and creates routes to serve every call described.
Builds the ServiceInfo metadata.
T - type constraint ensuring serviceImplementation implements
serviceInterfaceserviceInterface - the interface class for a ServiceserviceImplementation - the implementation class for the serviceInterfacedefault <T extends Service> void bindService(Class<T> serviceInterface, T service)
Inspects the service descriptor and creates routes to serve every call described.
Builds the ServiceInfo metadata.
T - type constraint ensuring serviceImplementation implements
serviceInterfaceserviceInterface - the interface class for a Serviceservice - an instance of a class implementing serviceInterfacedefault <T> ServiceGuiceSupport.ServiceBinding<T> serviceBinding(Class<T> serviceInterface, Class<? extends T> serviceImplementation)
ServiceGuiceSupport.ServiceBinding when using bindServices(ServiceBinding[]).ServiceGuiceSupport.ServiceBinding to be used as argument in bindServices(ServiceBinding[]).default <T> ServiceGuiceSupport.ServiceBinding<T> serviceBinding(Class<T> serviceInterface, T service)
ServiceGuiceSupport.ServiceBinding when using bindServices(ServiceBinding[]).T - type constraint ensuring service implements serviceInterface
serviceInterface - the interface class for a serviceservice - an instance of the serviceServiceGuiceSupport.ServiceBinding to be used as argument in bindServices(ServiceBinding[]).