Search in sources :

Example 1 with TimerData

use of com.uber.cadence.internal.testservice.StateMachines.TimerData 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)

Aggregations

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