use of com.uber.cadence.internal.replay.QueryWorkflowParameters in project cadence-client by uber-java.
the class WorkflowStubImpl method query.
@Override
public <R> R query(String queryType, Class<R> returnType, Object... args) {
checkStarted();
QueryWorkflowParameters p = new QueryWorkflowParameters();
p.setInput(dataConverter.toData(args));
p.setQueryType(queryType);
p.setWorkflowId(execution.get().getWorkflowId());
try {
byte[] result = genericClient.queryWorkflow(p);
return dataConverter.fromData(result, returnType);
} catch (RuntimeException e) {
Exception unwrapped = CheckedExceptionWrapper.unwrap(e);
if (unwrapped instanceof EntityNotExistsError) {
throw new WorkflowNotFoundException(execution.get(), workflowType, e.getMessage());
}
if (unwrapped instanceof QueryFailedError) {
throw new WorkflowQueryException(execution.get(), unwrapped.getMessage());
}
if (unwrapped instanceof InternalServiceError) {
throw new WorkflowServiceException(execution.get(), workflowType, unwrapped);
}
throw e;
}
}
Aggregations