Interface ServiceClientFactory
-
- All Known Implementing Classes:
ServiceClientFactoryImpl
public interface ServiceClientFactoryThis is the interface for a factory used tocreateclient stubs for aService. The following example shows the typical usage in your code:@
As you can see creating a service client stub is easy and requires only a single line of code. However, internally a lot of things happen such as the following aspects:Namedpublic class UcMyUseCaseImpl extends MyUseCaseBase implements UcMyUseCase { @InjectprivateServiceClientFactoryclientFactory; @Override@javax.annotation.security.RolesAllowed(...) public Foo doSomething(Bar bar) { MyExternalServiceApi externalService = this.clientFactory.create(MyExternalServiceApi.class); Some result = externalService.doSomething(convert(bar)); return convert(result); } }service discovery.header customization(for security, correlation-ID, etc.).- performance logging
- exception mapping (exception facade)
- Since:
- 3.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <S> Screate(Class<S> serviceInterface)<S> Screate(Class<S> serviceInterface, Map<String,String> config)
-
-
-
Method Detail
-
create
<S> S create(Class<S> serviceInterface)
- Type Parameters:
S- the generic type of theserviceInterface. For flexibility and being not invasive this generic is not bound toService(S extends Service).- Parameters:
serviceInterface- theClassreflecting the interface that defines the API of yourService.- Returns:
- a new instance of the given
serviceInterfacethat is a client stub. Invocations to any of the service methods will trigger a remote call and synchronously return the result.
-
create
<S> S create(Class<S> serviceInterface, Map<String,String> config)
- Type Parameters:
S- the generic type of theserviceInterface. For flexibility and being not invasive this generic is not bound toService(S extends Service).- Parameters:
serviceInterface- theClassreflecting the interface that defines the API of yourService.config- theMapwith explicit configuration properties. SeeServiceConfigPropertiesfor further details.- Returns:
- a new instance of the given
serviceInterfacethat is a client stub. Invocations to any of the service methods will trigger a remote call and synchronously return the result.
-
-