Search in sources :

Example 6 with ActivityType

use of com.uber.cadence.ActivityType in project cadence-client by uber-java.

the class ActivityDecisionContext method handleActivityTaskCanceled.

void handleActivityTaskCanceled(HistoryEvent event) {
    ActivityTaskCanceledEventAttributes attributes = event.getActivityTaskCanceledEventAttributes();
    String activityId = decisions.getActivityId(attributes);
    if (decisions.handleActivityTaskCanceled(event)) {
        CancellationException e = new CancellationException();
        OpenRequestInfo<byte[], ActivityType> scheduled = scheduledActivities.remove(activityId);
        if (scheduled != null) {
            BiConsumer<byte[], Exception> completionHandle = scheduled.getCompletionCallback();
            // It is OK to fail with subclass of CancellationException when cancellation requested.
            // It allows passing information about cancellation (details in this case) to the surrounding doCatch block
            completionHandle.accept(null, e);
        }
    }
}
Also used : ActivityTaskCanceledEventAttributes(com.uber.cadence.ActivityTaskCanceledEventAttributes) CancellationException(java.util.concurrent.CancellationException) ActivityType(com.uber.cadence.ActivityType) CancellationException(java.util.concurrent.CancellationException)

Aggregations

ActivityType (com.uber.cadence.ActivityType)6 CancellationException (java.util.concurrent.CancellationException)5 ActivityTaskCanceledEventAttributes (com.uber.cadence.ActivityTaskCanceledEventAttributes)1 ActivityTaskCompletedEventAttributes (com.uber.cadence.ActivityTaskCompletedEventAttributes)1 ActivityTaskFailedEventAttributes (com.uber.cadence.ActivityTaskFailedEventAttributes)1 ActivityTaskTimedOutEventAttributes (com.uber.cadence.ActivityTaskTimedOutEventAttributes)1 ScheduleActivityTaskDecisionAttributes (com.uber.cadence.ScheduleActivityTaskDecisionAttributes)1 TaskList (com.uber.cadence.TaskList)1 TimeoutType (com.uber.cadence.TimeoutType)1 ActivityTaskFailedException (com.uber.cadence.internal.replay.ActivityTaskFailedException)1 ActivityTaskTimeoutException (com.uber.cadence.internal.replay.ActivityTaskTimeoutException)1 ChildWorkflowTaskFailedException (com.uber.cadence.internal.replay.ChildWorkflowTaskFailedException)1 ExecuteActivityParameters (com.uber.cadence.internal.replay.ExecuteActivityParameters)1 ActivityException (com.uber.cadence.workflow.ActivityException)1 ActivityFailureException (com.uber.cadence.workflow.ActivityFailureException)1 ActivityTimeoutException (com.uber.cadence.workflow.ActivityTimeoutException)1 ChildWorkflowException (com.uber.cadence.workflow.ChildWorkflowException)1 ChildWorkflowFailureException (com.uber.cadence.workflow.ChildWorkflowFailureException)1 SignalExternalWorkflowException (com.uber.cadence.workflow.SignalExternalWorkflowException)1