Functional approach
Since Content Integration Framework does not initiate and manage the outgoing connections in case of Functional services, it cannot keep track of end to end success.
Hence, it provides certain standard exceptions, which the service implementations can
throw to convey relevant failure conditions. These exceptions are related to
communication with the target system and are present within the
com.hcl.unica.system.integration.exception
package.
- SystemNotFoundException
This exception must be used when the target system or content repository cannot be located. Alternatively,
java.net.UnknownHostException
can also be used. This exception is conveyed as 404 HTTP response to the client. - ServiceNotFoundException
This exception must be used when the remote endpoint returns 404, or if the target service no longer exists. Absence of the target system and the absence of the required service are considered as different things. Hence, the
ServiceNotFoundException
conveys presence of the target system and the absence of the required service, or feature, on the target system. For example, in case of content fetched from the database, the absence of the required table (or the absence of the permission to access it) can be conveyed using this exception. This exception is conveyed as 404 HTTP response to the client. - UnreachableSystemException
This exception must be used to convey unreachable or inaccessible target systems, such as connection timeout. Alternatively,
java.net.ConnectException
can also be used. This exception is conveyed as 503 HTTP response to the client. - SluggishSystemException
When the response from the target system is not received within expected time, this exception must be used to convey the slowness of the target system. Alternatively,
java.net.SocketTimeoutException
can also be used. This exception is conveyed as 504 HTTP response to the client. - InternalSystemError
This exception must be used if the plugin receives a temporary, or unexpected, error from the target system to convey the problems in it. This exception is conveyed as 502 HTTP response to the client.
Any other exceptions are conveyed as 502 HTTP response to the client. In any case, the message in the exception is never returned to the client. Each HTTP response code carries a fixed, generic, and localized message.
Content Integration Framework wraps the exceptions received from service implementations
into
com.hcl.unica.system.integration.exception.ServiceExecutionException
or its subtype. Exceptions received from REST-based services or HTTP-based services are
wrapped in
com.hcl.unica.system.integration.exception.HttpServiceExecutionException
,
whereas the ones received from Functional services are wrapped in
com.hcl.unica.system.integration.exception.ServiceExecutionException
.
As explained in Service invocation,
HttpServiceExecutionException
provides a method to obtain an
Optional<HttpResponse>
object. If the service execution fails
before initiating an HTTP call, then this Optional object will not contain any
HttpResponse
.