Caching a Service Health Check Response
You can cache a Service Health Check response. This prevents a large number of unnecessary repetitive downstream calls in an application chain. This is an in-memory cache and is destroyed when a node is restarted.
Service Runtime Exceptions, such as TimeoutExceptions, are also cached. Validation failures are not cached.
To cache a Service Health Check response:
Enter appropriate values in the Refresh cache, Validity Duration and Refresh If Older Than input boxes when invoking the health check.
For more information about these parameters, see Request Parameters.
Example of a Caching Related Request using ActiveMatrix Administrator UI
Caching-related parameters must be entered in Advanced tab when invoking the Service Health Check request as displayed in the following example:
Example of a Caching Related Response using ActiveMatrix Administrator UI
The following example displays the Health Check response for the request in above example.
Example of a Caching Related Request using SOAP Client
Specify the caching-related parameters as shown in the following example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:heal="http://www.tibco.com/healthcheck/"> <soapenv:Header/> <soapenv:Body> <heal:HealthCheckRequest> <hops>-1</hops> <suppressStackTrace>False</suppressStackTrace> <timeout></timeout> <cache refreshCache="False" validityDurationInSecs="600" refreshIfOlderThan="40"/> </heal:HealthCheckRequest> </soapenv:Body> </soapenv:Envelope>
Example of a Caching Related Response using SOAP Client
The following response is seen for request in the above example. The attribute iscached is true which indicates that response is cached.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <HealthCheckResponse applicationName="jv.helloworld2.soa" cachedAtTime="15 Jul 2015 09:58:09,435" cachedForDurationInSecs="600" correlationID="a0ff4efeec94- 4619-833b-9a7415c7473f" isCached="true" status="Passed"> <Service bindingName="SOAPService_Binding1" bindingType="SOAP" endTime="15 Jul 2015 09:58:09,432" endpointURI="/hello/" environmentName="DevEnvironment" hostName="SystemHost" ipAddress="127.0.1.1" isSSLEnabled="false" machineName="Machine1" name="Hello" nodeName="DevNode" portTypeName="Hello" responseTime="2" soapVersion="1.1" startTime="15 Jul 2015 09:58:09,430" status="Passed" transportType="HTTP"> <Component endTime="15 Jul 2015 09:58:09,425" environmentName="DevEnvironment" hostName="SystemHost" name="Java1" nodeName="DevNode" responseTime="2" startTime="15 Jul 2015 09:58:09,423" status="Passed" version="1.0.0.v2015-05-06-1446"/> </Service> </HealthCheckResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Sample Request and Response using REST Client
HTTP Headers:
To make a request with JSON, the appropriate HTTP headers are:
Accept:application/json Content-Type:application/json
Request:
Specify the caching related parameters as shown in the following example:
{ "HealthCheckRequest": { "hops": "1", "suppressStackTrace": "False", "cache": { "@refreshCache": "false", "@validityDurationInSecs": "300", "@refreshIfOlderThan": "40" } } }
Response:
Following response is seen for caching request in the above example. Attribute isCached is set to true, which indicates that response is cached.
{ "HealthCheckResponse": { "@cachedForDurationInSecs": "300", "@correlationID": "c1359c1a-36a0-4d14-8392-6a7d7b663f0a", "@cachedAtTime": "23 May 2018 22:27:09,385", "@applicationName": "com.tibco.restbt.sample.bookstore", "@isCached": "true", "@status": "Passed", "Service": { "@bindingType": "REST", "@nodeName": "DevNode", "@hostName": "SystemHost", "@isSSLEnabled": "false", "@portTypeName": "BookStoreResource", "@responseTime": "1", "@ipAddress": "127.0.0.1", "@bindingName": "RESTService_Binding1", "@machineName": "test-workstation", "@environmentName": "DevEnvironment", "@name": "BookStoreResource", "@startTime": "23 May 2018 22:27:09,383", "@transportType": "HTTP", "@endTime": "23 May 2018 22:27:09,384", "@endpointURI": "urn:amx:DevEnvironment/ com.tibco.restbt.sample.bookstore#service-binding(BookStoreResource/ RESTService_Binding1)___1.0.0.v2014-12-31-1101", "@status": "Passed", "Component": { "@nodeName": "DevNode", "@componentType": "TIBCO-IT-JAVA", "@hostName": "SystemHost", "@environmentName": "DevEnvironment", "@responseTime": "1", "@name": "BookStoreResource", "@startTime": "23 May 2018 22:27:09,380", "@endTime": "23 May 2018 22:27:09,381", "@version": "1.0.0.v2014-12-31-1101", "@status": "Passed" } } } }