use of com.uber.cadence.RespondActivityTaskCompletedByIDRequest in project cadence-client by uber-java.
the class ManualActivityCompletionClientImpl method complete.
@Override
public void complete(Object result) {
if (taskToken != null) {
RespondActivityTaskCompletedRequest request = new RespondActivityTaskCompletedRequest();
byte[] convertedResult = dataConverter.toData(result);
request.setResult(convertedResult);
request.setTaskToken(taskToken);
try {
service.RespondActivityTaskCompleted(request);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(e);
}
} else {
if (activityId == null) {
throw new IllegalArgumentException("Either activity id or task token are required");
}
RespondActivityTaskCompletedByIDRequest request = new RespondActivityTaskCompletedByIDRequest();
request.setActivityID(activityId);
byte[] convertedResult = dataConverter.toData(result);
request.setResult(convertedResult);
request.setDomain(domain);
request.setWorkflowID(execution.getWorkflowId());
request.setRunID(execution.getRunId());
try {
service.RespondActivityTaskCompletedByID(request);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(activityId, e);
}
}
}
Aggregations