use of com.uber.cadence.RespondActivityTaskCanceledByIDRequest in project cadence-client by uber-java.
the class ManualActivityCompletionClientImpl method reportCancellation.
@Override
public void reportCancellation(Object details) {
if (taskToken != null) {
RespondActivityTaskCanceledRequest request = new RespondActivityTaskCanceledRequest();
request.setDetails(dataConverter.toData(details));
request.setTaskToken(taskToken);
try {
service.RespondActivityTaskCanceled(request);
} catch (TException e) {
// There is nothing that can be done at this point.
// so let's just ignore.
log.info("reportCancellation", e);
}
} else {
RespondActivityTaskCanceledByIDRequest request = new RespondActivityTaskCanceledByIDRequest();
request.setDetails(dataConverter.toData(details));
request.setDomain(domain);
request.setWorkflowID(execution.getWorkflowId());
request.setRunID(execution.getRunId());
try {
service.RespondActivityTaskCanceledByID(request);
} catch (TException e) {
// There is nothing that can be done at this point.
// so let's just ignore.
log.info("reportCancellation", e);
}
}
}
use of com.uber.cadence.RespondActivityTaskCanceledByIDRequest in project cadence-client by uber-java.
the class StateMachines method reportActivityTaskCancellation.
private static void reportActivityTaskCancellation(RequestContext ctx, ActivityTaskData data, Object request, long notUsed) {
byte[] details = null;
if (request instanceof RespondActivityTaskCanceledRequest) {
details = ((RespondActivityTaskCanceledRequest) request).getDetails();
} else if (request instanceof RespondActivityTaskCanceledByIDRequest) {
details = ((RespondActivityTaskCanceledByIDRequest) request).getDetails();
}
ActivityTaskCanceledEventAttributes a = new ActivityTaskCanceledEventAttributes().setScheduledEventId(data.scheduledEventId).setStartedEventId(data.startedEventId);
if (details != null) {
a.setDetails(details);
}
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskCanceled).setActivityTaskCanceledEventAttributes(a);
ctx.addEvent(event);
}
Aggregations