use of com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes in project cadence-client by uber-java.
the class DecisionsHelper method handleRequestCancelActivityTaskFailed.
boolean handleRequestCancelActivityTaskFailed(HistoryEvent event) {
RequestCancelActivityTaskFailedEventAttributes attributes = event.getRequestCancelActivityTaskFailedEventAttributes();
String activityId = attributes.getActivityId();
DecisionStateMachine decision = getDecision(new DecisionId(DecisionTarget.ACTIVITY, activityId));
decision.handleCancellationFailureEvent(event);
return decision.isDone();
}
use of com.uber.cadence.RequestCancelActivityTaskFailedEventAttributes in project cadence-client by uber-java.
the class TestWorkflowMutableStateImpl method processRequestCancelActivityTask.
private void processRequestCancelActivityTask(RequestContext ctx, RequestCancelActivityTaskDecisionAttributes a, long decisionTaskCompletedId) throws InternalServiceError {
String activityId = a.getActivityId();
StateMachine<?> activity = activities.get(activityId);
if (activity == null) {
RequestCancelActivityTaskFailedEventAttributes failedAttr = new RequestCancelActivityTaskFailedEventAttributes().setActivityId(activityId).setCause("ACTIVITY_ID_UNKNOWN").setDecisionTaskCompletedEventId(decisionTaskCompletedId);
HistoryEvent cancellationFailed = new HistoryEvent().setEventType(EventType.RequestCancelActivityTaskFailed).setRequestCancelActivityTaskFailedEventAttributes(failedAttr);
ctx.addEvent(cancellationFailed);
return;
}
State beforeState = activity.getState();
activity.action(StateMachines.Action.REQUEST_CANCELLATION, ctx, a, decisionTaskCompletedId);
if (beforeState == StateMachines.State.INITIATED) {
activity.action(StateMachines.Action.CANCEL, ctx, null, 0);
activities.remove(activityId);
ctx.setNeedDecision(true);
}
}
Aggregations