• [+] expand all

Developing client providers

The com.yahoo.jdisc.service.ClientProvider interface defines a component that is capable of acting as a client to an external server. This document explains how to implement and deploy a custom client provider.

The client providers of a JDisc application manage all outgoing requests made to remote services. Upon receiving a com.yahoo.jdisc.Request, it initiates a corresponding connection to the appropriate remote server. Once the remote server responds, the client provider instantiates and dispatches a corresponding com.yahoo.jdisc.Response. To implement a client provider, either implement the ClientProvider interface directly, or subclass the more convenient AbstractClientProvider. Please note the following:

  • The code necessary to handle a request and its content is the same as for handling a request in a request handler.
  • The code necessary to dispatch a response and write its content into the returned ContentChannel is the same as for dispatching a response from a request handler.

To install a client provider in a container, use the client element in services.xml, e.g.:

<container id="default" version="1.0">
    <client id="my.package.MyClientProvider" bundle="the name in <artifactId> in your pom.xml">
        <node hostalias="node1" />

Notice that the binding element declared within a client element implies a client-binding. To configure a server-binding for a client, use the serverBinding element instead.