Search in sources :

Example 11 with HistoryEvent

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

the class StateMachines method failDecisionTask.

private static void failDecisionTask(RequestContext ctx, DecisionTaskData data, RespondDecisionTaskFailedRequest request, long notUsed) {
    DecisionTaskFailedEventAttributes a = new DecisionTaskFailedEventAttributes().setIdentity(request.getIdentity()).setCause(request.getCause()).setDetails(request.getDetails()).setStartedEventId(data.previousStartedEventId).setScheduledEventId(data.scheduledEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.DecisionTaskFailed).setDecisionTaskFailedEventAttributes(a);
    ctx.addEvent(event);
}
Also used : DecisionTaskFailedEventAttributes(com.uber.cadence.DecisionTaskFailedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 12 with HistoryEvent

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

the class StateMachines method childWorkflowCanceled.

private static void childWorkflowCanceled(RequestContext ctx, ChildWorkflowData data, ChildWorkflowExecutionCanceledEventAttributes a, long notUsed) {
    a.setInitiatedEventId(data.initiatedEventId);
    a.setStartedEventId(data.startedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ChildWorkflowExecutionCanceled).setChildWorkflowExecutionCanceledEventAttributes(a);
    ctx.addEvent(event);
}
Also used : HistoryEvent(com.uber.cadence.HistoryEvent)

Example 13 with HistoryEvent

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

the class StateMachines method failActivityTaskById.

private static void failActivityTaskById(RequestContext ctx, ActivityTaskData data, RespondActivityTaskFailedByIDRequest request) {
    ActivityTaskFailedEventAttributes a = new ActivityTaskFailedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId).setDetails(request.getDetails()).setReason(request.getReason()).setIdentity(request.getIdentity()).setStartedEventId(data.startedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskFailed).setActivityTaskFailedEventAttributes(a);
    ctx.addEvent(event);
}
Also used : ActivityTaskFailedEventAttributes(com.uber.cadence.ActivityTaskFailedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 14 with HistoryEvent

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

the class StateMachines method childWorkflowStarted.

private static void childWorkflowStarted(RequestContext ctx, ChildWorkflowData data, ChildWorkflowExecutionStartedEventAttributes a, long notUsed) {
    a.setInitiatedEventId(data.initiatedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ChildWorkflowExecutionStarted).setChildWorkflowExecutionStartedEventAttributes(a);
    long startedEventId = ctx.addEvent(event);
    ctx.onCommit((historySize) -> {
        data.startedEventId = startedEventId;
        data.execution = a.getWorkflowExecution();
    });
}
Also used : HistoryEvent(com.uber.cadence.HistoryEvent)

Example 15 with HistoryEvent

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

the class StateMachines method startActivityTask.

private static void startActivityTask(RequestContext ctx, ActivityTaskData data, PollForActivityTaskRequest request, long notUsed) {
    ActivityTaskStartedEventAttributes a = new ActivityTaskStartedEventAttributes().setIdentity(request.getIdentity()).setScheduledEventId(data.scheduledEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskStarted).setActivityTaskStartedEventAttributes(a);
    long startedEventId = ctx.addEvent(event);
    ctx.onCommit((historySize) -> {
        data.startedEventId = startedEventId;
        data.activityTask.setTaskToken(new ActivityId(ctx.getExecutionId(), data.activityTask.getActivityId()).toBytes());
        data.activityTask.setStartedTimestamp(ctx.currentTimeInNanoseconds());
    });
}
Also used : ActivityTaskStartedEventAttributes(com.uber.cadence.ActivityTaskStartedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Aggregations

HistoryEvent (com.uber.cadence.HistoryEvent)49 History (com.uber.cadence.History)5 WorkflowExecution (com.uber.cadence.WorkflowExecution)5 GetWorkflowExecutionHistoryRequest (com.uber.cadence.GetWorkflowExecutionHistoryRequest)4 GetWorkflowExecutionHistoryResponse (com.uber.cadence.GetWorkflowExecutionHistoryResponse)3 SignalExternalWorkflowExecutionInitiatedEventAttributes (com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes)3 ActivityTaskCompletedEventAttributes (com.uber.cadence.ActivityTaskCompletedEventAttributes)2 ActivityTaskFailedEventAttributes (com.uber.cadence.ActivityTaskFailedEventAttributes)2 ChildWorkflowExecutionTimedOutEventAttributes (com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)2 EntityNotExistsError (com.uber.cadence.EntityNotExistsError)2 PollForActivityTaskResponse (com.uber.cadence.PollForActivityTaskResponse)2 PollForDecisionTaskResponse (com.uber.cadence.PollForDecisionTaskResponse)2 SignalExternalWorkflowExecutionFailedEventAttributes (com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes)2 StartChildWorkflowExecutionInitiatedEventAttributes (com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes)2 StartWorkflowExecutionRequest (com.uber.cadence.StartWorkflowExecutionRequest)2 WorkflowExecutionContinuedAsNewEventAttributes (com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes)2 WorkflowExecutionSignaledEventAttributes (com.uber.cadence.WorkflowExecutionSignaledEventAttributes)2 WorkflowExecutionStartedEventAttributes (com.uber.cadence.WorkflowExecutionStartedEventAttributes)2 TaskListId (com.uber.cadence.internal.testservice.TestWorkflowStore.TaskListId)2 ArrayList (java.util.ArrayList)2