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)
Provides the ServiceInfo to use Lagom service clients.
|
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[]) . |
bindClient
default void bindServiceInfo(ServiceInfo serviceInfo)
ServiceClientGuiceSupport
bindServiceInfo
in interface ServiceClientGuiceSupport
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.ServiceBinding
s. Use the convenience method
serviceBinding(Class, Class)
to build the
ServiceGuiceSupport.ServiceBinding
s. 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 serviceInterface
serviceInterface
- the interface class for a Service
serviceImplementation
- the implementation class for the serviceInterface
default <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 serviceInterface
serviceInterface
- the interface class for a Service
service
- an instance of a class implementing serviceInterface
default <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[])
.