use of com.datatorrent.stram.client.WebServicesVersionConversion.IncompatibleVersionException in project apex-core by apache.
the class RecordingsAgent method startRecording.
public JSONObject startRecording(String appId, String opId, String portName, long numWindows) throws IncompatibleVersionException {
LOG.debug("Start recording requested for {}.{} ({} windows)", opId, portName, numWindows);
try {
final JSONObject request = new JSONObject();
StramAgent.StramUriSpec uriSpec = new StramAgent.StramUriSpec();
uriSpec = uriSpec.path(StramWebServices.PATH_PHYSICAL_PLAN_OPERATORS).path(opId);
if (!StringUtils.isBlank(portName)) {
uriSpec = uriSpec.path("ports").path(portName);
}
uriSpec = uriSpec.path(StramWebServices.PATH_RECORDINGS_START);
request.put("numWindows", numWindows);
WebServicesClient webServicesClient = new WebServicesClient();
return stramAgent.issueStramWebRequest(webServicesClient, appId, uriSpec, new WebServicesClient.WebServicesHandler<JSONObject>() {
@Override
public JSONObject process(WebResource.Builder webResource, Class<JSONObject> clazz) {
return webResource.type(MediaType.APPLICATION_JSON).post(clazz, request);
}
});
} catch (Exception ex) {
LOG.error("Cannot start recording: ", ex);
return null;
}
}
use of com.datatorrent.stram.client.WebServicesVersionConversion.IncompatibleVersionException in project apex-core by apache.
the class RecordingsAgent method stopRecording.
public JSONObject stopRecording(String appId, String opId, String portName) throws IncompatibleVersionException {
try {
final JSONObject request = new JSONObject();
StramAgent.StramUriSpec uriSpec = new StramAgent.StramUriSpec();
uriSpec = uriSpec.path(StramWebServices.PATH_PHYSICAL_PLAN_OPERATORS).path(opId);
if (!StringUtils.isBlank(portName)) {
uriSpec = uriSpec.path("ports").path(portName);
}
uriSpec = uriSpec.path(StramWebServices.PATH_RECORDINGS_STOP);
WebServicesClient webServicesClient = new WebServicesClient();
return stramAgent.issueStramWebRequest(webServicesClient, appId, uriSpec, new WebServicesClient.WebServicesHandler<JSONObject>() {
@Override
public JSONObject process(WebResource.Builder webResource, Class<JSONObject> clazz) {
return webResource.type(MediaType.APPLICATION_JSON).post(clazz, request);
}
});
} catch (Exception ex) {
LOG.error("Cannot stop recording: ", ex);
return null;
}
}
Aggregations