Search in sources :

Example 1 with TimeoutType

use of com.uber.cadence.TimeoutType 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);
        }
    }
}
Also used : ActivityTaskTimedOutEventAttributes(com.uber.cadence.ActivityTaskTimedOutEventAttributes) TimeoutType(com.uber.cadence.TimeoutType) ActivityType(com.uber.cadence.ActivityType) CancellationException(java.util.concurrent.CancellationException)

Aggregations

ActivityTaskTimedOutEventAttributes (com.uber.cadence.ActivityTaskTimedOutEventAttributes)1 ActivityType (com.uber.cadence.ActivityType)1 TimeoutType (com.uber.cadence.TimeoutType)1 CancellationException (java.util.concurrent.CancellationException)1