use of com.uber.cadence.ActivityTaskFailedEventAttributes in project cadence-client by uber-java.
the class StateMachines method failActivityTaskById.
private static void failActivityTaskById(RequestContext ctx, ActivityTaskData data, RespondActivityTaskFailedByIDRequest request) {
ActivityTaskFailedEventAttributes a = new ActivityTaskFailedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setDetails(request.getDetails()).setReason(request.getReason()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskFailed).setActivityTaskFailedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.ActivityTaskFailedEventAttributes in project cadence-client by uber-java.
the class StateMachines method failActivityTaskByTaskToken.
private static void failActivityTaskByTaskToken(RequestContext ctx, ActivityTaskData data, RespondActivityTaskFailedRequest request) {
ActivityTaskFailedEventAttributes a = new ActivityTaskFailedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setDetails(request.getDetails()).setReason(request.getReason()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskFailed).setActivityTaskFailedEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.ActivityTaskFailedEventAttributes in project cadence-client by uber-java.
the class ActivityDecisionContext method handleActivityTaskFailed.
void handleActivityTaskFailed(HistoryEvent event) {
ActivityTaskFailedEventAttributes attributes = event.getActivityTaskFailedEventAttributes();
String activityId = decisions.getActivityId(attributes);
if (decisions.handleActivityTaskClosed(activityId)) {
OpenRequestInfo<byte[], ActivityType> scheduled = scheduledActivities.remove(activityId);
if (scheduled != null) {
String reason = attributes.getReason();
byte[] details = attributes.getDetails();
ActivityTaskFailedException failure = new ActivityTaskFailedException(event.getEventId(), scheduled.getUserContext(), activityId, reason, details);
BiConsumer<byte[], Exception> completionHandle = scheduled.getCompletionCallback();
completionHandle.accept(null, failure);
}
}
}
Aggregations