Configure Underlying Clients
The service framework wraps most functionality of the underlying clients (FTPClient, HTTPClient, and so on), but you can directly configure the underlying clients when needed.
For example, if you want to cache web service calls for
HTTPService
, in your createRequest
callback, use the getClient
method to get the underlying
HTTPClient
object for the service and use the
HTTPClient
class enableCaching
method to
cache the request.
LocalServiceRegistry.createService("yourService", {
createRequest: function(svc:HTTPService, args) {
svc.client.enableCaching(1000);
[...]
Note: Make sure to use getClient and any HTTPClient methods in the
createRequest callback or later callbacks, not when you get the service
object from the registry. This is because the underlying HTTPclient object
isn't initialized until you call the service using the createRequest
object. Before calling the service, using getClient only returns
null.
Cached requests are seen in the dashboard and you should see
lower average execution times once caching is enabled. Cached requests are
counted toward rate limits, circuit breakers, and statistics, because all
of these are measured at the service level and are triggered by calls to
the service.