Class AbstractEndpointClient
java.lang.Object
es.kukenan.smartfi.microservice.contracts.service.AbstractEndpointClient
- Direct Known Subclasses:
AbstractCoreEndpointClient
Base class with core functionality for any endpoint implementation.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanFlag that signals if the processing must stop if there is any king of client or mapping error. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected URICreate a URI object from the given Minstait relative endpoint path.protected URICreate a URI object from the given relative endpoint path.protected <T> TextractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.protected <T> ThandleConnectionException(Supplier<T> supplier) Performs the operation encapsulated in the supplier instance to handle connection exceptions.protected Stringmessage(org.springframework.web.client.ResourceAccessException e) Construct an error message from a givenResourceAccessException.
-
Field Details
-
haltOnErrors
@Value("${services.client.halt-on-errors}") protected boolean haltOnErrorsFlag that signals if the processing must stop if there is any king of client or mapping error.
-
-
Constructor Details
-
AbstractEndpointClient
public AbstractEndpointClient()
-
-
Method Details
-
createUri
Create a URI object from the given Minstait relative endpoint path.- Parameters:
uriPath- Minstait relative endpoint path.- Returns:
- URI object with absolute endpoint path.
-
createUri
Create a URI object from the given relative endpoint path.- Parameters:
uriPath- relative endpoint path.queryParams- Query PArams to add at endpoint path.- Returns:
- URI object with absolute endpoint path.
-
handleConnectionException
Performs the operation encapsulated in the supplier instance to handle connection exceptions.- Type Parameters:
T- the result type of the operation.- Parameters:
supplier- an operation encapsulated a the supplier instance.- Returns:
- the result of the operation if no exception has been thrown.
-
message
Construct an error message from a givenResourceAccessException.- Parameters:
e- aResourceAccessException.- Returns:
- a message describing the exception reason.
-
extractResponseData
protected <T> T extractResponseData(org.springframework.http.ResponseEntity<T> responseEntity) Extract the response data from the givenResponseEntity.- Type Parameters:
T- CoreResponse type.- Parameters:
responseEntity-ResponseEntity.- Returns:
- core response data.
-