use of com.uber.cadence.ActivityTaskTimedOutEventAttributes in project cadence-client by uber-java.
the class ActivityDecisionContext method handleActivityTaskTimedOut.
void handleActivityTaskTimedOut(HistoryEvent event) {
ActivityTaskTimedOutEventAttributes attributes = event.getActivityTaskTimedOutEventAttributes();
String activityId = decisions.getActivityId(attributes);
if (decisions.handleActivityTaskClosed(activityId)) {
OpenRequestInfo<byte[], ActivityType> scheduled = scheduledActivities.remove(activityId);
if (scheduled != null) {
TimeoutType timeoutType = attributes.getTimeoutType();
byte[] details = attributes.getDetails();
ActivityTaskTimeoutException failure = new ActivityTaskTimeoutException(event.getEventId(), scheduled.getUserContext(), activityId, timeoutType, details);
BiConsumer<byte[], Exception> completionHandle = scheduled.getCompletionCallback();
completionHandle.accept(null, failure);
}
}
}
use of com.uber.cadence.ActivityTaskTimedOutEventAttributes in project cadence-client by uber-java.
the class StateMachines method timeoutActivityTask.
private static void timeoutActivityTask(RequestContext ctx, ActivityTaskData data, TimeoutType timeoutType, long notUsed) {
ActivityTaskTimedOutEventAttributes a = new ActivityTaskTimedOutEventAttributes().setScheduledEventId(data.scheduledEventId).setDetails(data.heartbeatDetails).setTimeoutType(timeoutType).setStartedEventId(data.startedEventId);
HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskTimedOut).setActivityTaskTimedOutEventAttributes(a);
ctx.addEvent(event);
}
Aggregations