use of com.linkedin.restli.client.multiplexer.MultiplexedCallback in project rest.li by linkedin.
the class RestClient method sendRequest.
/**
* Sends a multiplexed request. Responses are provided to individual requests' callbacks. After all responses are
* received the given aggregated callback is invoked.
*
* The request is sent using the protocol version 2.0.
*
* @param multiplexedRequest the multiplexed request to send.
* @param requestContext context for the request
* @param callback the aggregated response callback.
*/
public void sendRequest(MultiplexedRequest multiplexedRequest, RequestContext requestContext, Callback<MultiplexedResponse> callback) {
MultiplexedCallback muxCallback = new MultiplexedCallback(multiplexedRequest.getCallbacks(), callback);
addDisruptContext(MULTIPLEXER_RESOURCE, requestContext);
try {
RestRequest restRequest = buildMultiplexedRequest(multiplexedRequest);
_client.restRequest(restRequest, requestContext, muxCallback);
} catch (Exception e) {
muxCallback.onError(e);
}
}
Aggregations