use of com.uber.cadence.RespondActivityTaskFailedByIDRequest in project cadence-client by uber-java.
the class ManualActivityCompletionClientImpl method fail.
@Override
public void fail(Throwable failure) {
if (failure == null) {
throw new IllegalArgumentException("null failure");
}
// When converting failures reason is class name, details are serialized exception.
if (taskToken != null) {
RespondActivityTaskFailedRequest request = new RespondActivityTaskFailedRequest();
request.setReason(failure.getClass().getName());
request.setDetails(dataConverter.toData(failure));
request.setTaskToken(taskToken);
try {
service.RespondActivityTaskFailed(request);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(e);
}
} else {
RespondActivityTaskFailedByIDRequest request = new RespondActivityTaskFailedByIDRequest();
request.setReason(failure.getClass().getName());
request.setDetails(dataConverter.toData(failure));
request.setDomain(domain);
request.setWorkflowID(execution.getWorkflowId());
request.setRunID(execution.getRunId());
try {
service.RespondActivityTaskFailedByID(request);
} catch (EntityNotExistsError e) {
throw new ActivityNotExistsException(e);
} catch (TException e) {
throw new ActivityCompletionFailureException(activityId, e);
}
}
}
Aggregations