Search in sources :

Example 6 with HistoryEvent

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

the class StateMachines method cancelWorkflow.

private static void cancelWorkflow(RequestContext ctx, WorkflowData data, CancelWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedEventId) {
    WorkflowExecutionCanceledEventAttributes a = new WorkflowExecutionCanceledEventAttributes().setDetails(d.getDetails()).setDecisionTaskCompletedEventId(decisionTaskCompletedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.WorkflowExecutionCanceled).setWorkflowExecutionCanceledEventAttributes(a);
    ctx.addEvent(event);
}
Also used : WorkflowExecutionCanceledEventAttributes(com.uber.cadence.WorkflowExecutionCanceledEventAttributes) ChildWorkflowExecutionCanceledEventAttributes(com.uber.cadence.ChildWorkflowExecutionCanceledEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 7 with HistoryEvent

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

the class StateMachines method childWorkflowCompleted.

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

Example 8 with HistoryEvent

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

the class StateMachines method continueAsNewWorkflow.

private static void continueAsNewWorkflow(RequestContext ctx, WorkflowData data, ContinueAsNewWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedEventId) {
    StartWorkflowExecutionRequest sr = ctx.getWorkflowMutableState().getStartRequest();
    WorkflowExecutionContinuedAsNewEventAttributes a = new WorkflowExecutionContinuedAsNewEventAttributes();
    a.setInput(d.getInput());
    if (d.isSetExecutionStartToCloseTimeoutSeconds()) {
        a.setExecutionStartToCloseTimeoutSeconds(d.getExecutionStartToCloseTimeoutSeconds());
    } else {
        a.setExecutionStartToCloseTimeoutSeconds(sr.getExecutionStartToCloseTimeoutSeconds());
    }
    if (d.isSetTaskList()) {
        a.setTaskList(d.getTaskList());
    } else {
        a.setTaskList(sr.getTaskList());
    }
    if (d.isSetWorkflowType()) {
        a.setWorkflowType(d.getWorkflowType());
    } else {
        a.setWorkflowType(sr.getWorkflowType());
    }
    if (d.isSetTaskStartToCloseTimeoutSeconds()) {
        a.setTaskStartToCloseTimeoutSeconds(d.getTaskStartToCloseTimeoutSeconds());
    } else {
        a.setTaskStartToCloseTimeoutSeconds(sr.getTaskStartToCloseTimeoutSeconds());
    }
    a.setDecisionTaskCompletedEventId(decisionTaskCompletedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.WorkflowExecutionContinuedAsNew).setWorkflowExecutionContinuedAsNewEventAttributes(a);
    ctx.addEvent(event);
}
Also used : StartWorkflowExecutionRequest(com.uber.cadence.StartWorkflowExecutionRequest) WorkflowExecutionContinuedAsNewEventAttributes(com.uber.cadence.WorkflowExecutionContinuedAsNewEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent)

Example 9 with HistoryEvent

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

the class StateMachines method childWorkflowFailed.

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

Example 10 with HistoryEvent

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

the class StateMachines method timeoutActivityTask.

private static void timeoutActivityTask(RequestContext ctx, ActivityTaskData data, TimeoutType timeoutType, long notUsed) {
    ActivityTaskTimedOutEventAttributes a = new ActivityTaskTimedOutEventAttributes().setScheduledEventId(data.scheduledEventId).setDetails(data.heartbeatDetails).setTimeoutType(timeoutType).setStartedEventId(data.startedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ActivityTaskTimedOut).setActivityTaskTimedOutEventAttributes(a);
    ctx.addEvent(event);
}
Also used : ActivityTaskTimedOutEventAttributes(com.uber.cadence.ActivityTaskTimedOutEventAttributes) 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