Search in sources :

Example 1 with CancelTimerFailedEventAttributes

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

the class TestWorkflowMutableStateImpl method processCancelTimer.

private void processCancelTimer(RequestContext ctx, CancelTimerDecisionAttributes d, long decisionTaskCompletedId) throws InternalServiceError {
    String timerId = d.getTimerId();
    StateMachine<TimerData> timer = timers.get(timerId);
    if (timer == null) {
        CancelTimerFailedEventAttributes failedAttr = new CancelTimerFailedEventAttributes().setTimerId(timerId).setCause("TIMER_ID_UNKNOWN").setDecisionTaskCompletedEventId(decisionTaskCompletedId);
        HistoryEvent cancellationFailed = new HistoryEvent().setEventType(EventType.CancelTimerFailed).setCancelTimerFailedEventAttributes(failedAttr);
        ctx.addEvent(cancellationFailed);
        return;
    }
    timer.action(StateMachines.Action.CANCEL, ctx, d, decisionTaskCompletedId);
    timers.remove(timerId);
}
Also used : TimerData(com.uber.cadence.internal.testservice.StateMachines.TimerData) CancelTimerFailedEventAttributes(com.uber.cadence.CancelTimerFailedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 2 with CancelTimerFailedEventAttributes

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

the class DecisionsHelper method handleCancelTimerFailed.

boolean handleCancelTimerFailed(HistoryEvent event) {
    CancelTimerFailedEventAttributes attributes = event.getCancelTimerFailedEventAttributes();
    DecisionStateMachine decision = getDecision(new DecisionId(DecisionTarget.TIMER, attributes.getTimerId()));
    decision.handleCancellationFailureEvent(event);
    return decision.isDone();
}
Also used : CancelTimerFailedEventAttributes(com.uber.cadence.CancelTimerFailedEventAttributes)

Aggregations

CancelTimerFailedEventAttributes (com.uber.cadence.CancelTimerFailedEventAttributes)2 HistoryEvent (com.uber.cadence.HistoryEvent)1 TimerData (com.uber.cadence.internal.testservice.StateMachines.TimerData)1