Search in sources :

Example 1 with StartChildWorkflowExecutionInitiatedEventAttributes

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

the class StateMachines method timeoutChildWorkflow.

private static void timeoutChildWorkflow(RequestContext ctx, ChildWorkflowData data, TimeoutType timeoutType, long notUsed) {
    StartChildWorkflowExecutionInitiatedEventAttributes ie = data.initiatedEvent;
    ChildWorkflowExecutionTimedOutEventAttributes a = new ChildWorkflowExecutionTimedOutEventAttributes().setDomain(ie.getDomain()).setStartedEventId(data.startedEventId).setWorkflowExecution(data.execution).setWorkflowType(ie.getWorkflowType()).setTimeoutType(timeoutType).setInitiatedEventId(data.initiatedEventId);
    HistoryEvent event = new HistoryEvent().setEventType(EventType.ChildWorkflowExecutionTimedOut).setChildWorkflowExecutionTimedOutEventAttributes(a);
    ctx.addEvent(event);
}
Also used : StartChildWorkflowExecutionInitiatedEventAttributes(com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent) ChildWorkflowExecutionTimedOutEventAttributes(com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)

Example 2 with StartChildWorkflowExecutionInitiatedEventAttributes

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

the class StateMachines method initiateChildWorkflow.

private static void initiateChildWorkflow(RequestContext ctx, ChildWorkflowData data, StartChildWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedEventId) {
    StartChildWorkflowExecutionInitiatedEventAttributes a = new StartChildWorkflowExecutionInitiatedEventAttributes().setControl(d.getControl()).setInput(d.getInput()).setChildPolicy(d.getChildPolicy()).setDecisionTaskCompletedEventId(decisionTaskCompletedEventId).setDomain(d.getDomain() == null ? ctx.getDomain() : d.getDomain()).setExecutionStartToCloseTimeoutSeconds(d.getExecutionStartToCloseTimeoutSeconds()).setTaskStartToCloseTimeoutSeconds(d.getTaskStartToCloseTimeoutSeconds()).setTaskList(d.getTaskList()).setWorkflowId(d.getWorkflowId()).setWorkflowIdReusePolicy(d.getWorkflowIdReusePolicy()).setWorkflowType(d.getWorkflowType());
    HistoryEvent event = new HistoryEvent().setEventType(EventType.StartChildWorkflowExecutionInitiated).setStartChildWorkflowExecutionInitiatedEventAttributes(a);
    long initiatedEventId = ctx.addEvent(event);
    ctx.onCommit((historySize) -> {
        data.initiatedEventId = initiatedEventId;
        data.initiatedEvent = a;
        StartWorkflowExecutionRequest startChild = new StartWorkflowExecutionRequest().setInput(d.getInput()).setDomain(d.getDomain() == null ? ctx.getDomain() : d.getDomain()).setExecutionStartToCloseTimeoutSeconds(d.getExecutionStartToCloseTimeoutSeconds()).setTaskStartToCloseTimeoutSeconds(d.getTaskStartToCloseTimeoutSeconds()).setTaskList(d.getTaskList()).setWorkflowId(d.getWorkflowId()).setWorkflowIdReusePolicy(d.getWorkflowIdReusePolicy()).setWorkflowType(d.getWorkflowType());
        addStartChildTask(ctx, data, initiatedEventId, startChild);
    });
}
Also used : StartChildWorkflowExecutionInitiatedEventAttributes(com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent) StartWorkflowExecutionRequest(com.uber.cadence.StartWorkflowExecutionRequest)

Example 3 with StartChildWorkflowExecutionInitiatedEventAttributes

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

the class DecisionsHelper method handleStartChildWorkflowExecutionInitiated.

void handleStartChildWorkflowExecutionInitiated(HistoryEvent event) {
    StartChildWorkflowExecutionInitiatedEventAttributes attributes = event.getStartChildWorkflowExecutionInitiatedEventAttributes();
    String workflowId = attributes.getWorkflowId();
    DecisionStateMachine decision = getDecision(new DecisionId(DecisionTarget.EXTERNAL_WORKFLOW, workflowId));
    decision.handleInitiatedEvent(event);
}
Also used : StartChildWorkflowExecutionInitiatedEventAttributes(com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes)

Aggregations

StartChildWorkflowExecutionInitiatedEventAttributes (com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes)3 HistoryEvent (com.uber.cadence.HistoryEvent)2 ChildWorkflowExecutionTimedOutEventAttributes (com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)1 StartWorkflowExecutionRequest (com.uber.cadence.StartWorkflowExecutionRequest)1