use of org.apache.apex.malhar.python.base.requestresponse.PythonInterpreterRequest in project apex-malhar by apache.
the class PythonRequestResponseUtil method buildRequestForMethodCallCommand.
/**
* Builds the request object for the Method call command. See
* {@link ApexPythonEngine#executeMethodCall(WorkerExecutionMode, long, long, PythonInterpreterRequest)} for details
* @param methodName Name of the method
* @param methodParams parames to the method
* @param timeOut Time allocated for completing the API
* @param timeUnit The units of time
* @param clazz The Class that represents the return type
* @param <T> Java templating signature
* @return The request object that can be used for method calls
*/
public static <T> PythonInterpreterRequest<T> buildRequestForMethodCallCommand(String methodName, List<Object> methodParams, long timeOut, TimeUnit timeUnit, Class<T> clazz) {
PythonInterpreterRequest<T> request = new PythonInterpreterRequest<>(clazz);
MethodCallRequestPayload methodCallRequestPayload = new MethodCallRequestPayload();
methodCallRequestPayload.setNameOfMethod(methodName);
methodCallRequestPayload.setArgs(methodParams);
request.setTimeUnit(timeUnit);
request.setTimeout(timeOut);
request.setMethodCallRequest(methodCallRequestPayload);
return request;
}
Aggregations