Search in sources :

Example 1 with ChildWorkflowExecutionStartedEventAttributes

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

the class TestWorkflowMutableStateImpl method startWorkflow.

@Override
public void startWorkflow() throws InternalServiceError, BadRequestError {
    try {
        update(ctx -> {
            workflow.action(StateMachines.Action.START, ctx, startRequest, 0);
            scheduleDecision(ctx);
            ctx.addTimer(startRequest.getExecutionStartToCloseTimeoutSeconds(), this::timeoutWorkflow);
        });
    } catch (EntityNotExistsError entityNotExistsError) {
        throw new InternalServiceError(Throwables.getStackTraceAsString(entityNotExistsError));
    }
    if (parent.isPresent()) {
        ChildWorkflowExecutionStartedEventAttributes a = new ChildWorkflowExecutionStartedEventAttributes().setWorkflowExecution(getExecutionId().getExecution()).setDomain(getExecutionId().getDomain()).setWorkflowType(startRequest.getWorkflowType());
        ForkJoinPool.commonPool().execute(() -> {
            try {
                parent.get().childWorkflowStarted(a);
            } catch (EntityNotExistsError entityNotExistsError) {
            // Not a problem. Parent might just close by now.
            } catch (BadRequestError | InternalServiceError e) {
                log.error("Failure reporting child completion", e);
            }
        });
    }
}
Also used : ChildWorkflowExecutionStartedEventAttributes(com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes) InternalServiceError(com.uber.cadence.InternalServiceError) EntityNotExistsError(com.uber.cadence.EntityNotExistsError) BadRequestError(com.uber.cadence.BadRequestError)

Example 2 with ChildWorkflowExecutionStartedEventAttributes

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

the class WorkflowDecisionContext method handleChildWorkflowExecutionStarted.

void handleChildWorkflowExecutionStarted(HistoryEvent event) {
    ChildWorkflowExecutionStartedEventAttributes attributes = event.getChildWorkflowExecutionStartedEventAttributes();
    WorkflowExecution execution = attributes.getWorkflowExecution();
    String workflowId = execution.getWorkflowId();
    decisions.handleChildWorkflowExecutionStarted(event);
    OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.get(workflowId);
    if (scheduled != null) {
        scheduled.getExecutionCallback().accept(attributes.getWorkflowExecution());
    }
}
Also used : ChildWorkflowExecutionStartedEventAttributes(com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes) WorkflowExecution(com.uber.cadence.WorkflowExecution)

Example 3 with ChildWorkflowExecutionStartedEventAttributes

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

the class DecisionsHelper method handleChildWorkflowExecutionStarted.

public void handleChildWorkflowExecutionStarted(HistoryEvent event) {
    ChildWorkflowExecutionStartedEventAttributes attributes = event.getChildWorkflowExecutionStartedEventAttributes();
    String workflowId = attributes.getWorkflowExecution().getWorkflowId();
    DecisionStateMachine decision = getDecision(new DecisionId(DecisionTarget.EXTERNAL_WORKFLOW, workflowId));
    decision.handleStartedEvent(event);
}
Also used : ChildWorkflowExecutionStartedEventAttributes(com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes)

Aggregations

ChildWorkflowExecutionStartedEventAttributes (com.uber.cadence.ChildWorkflowExecutionStartedEventAttributes)3 BadRequestError (com.uber.cadence.BadRequestError)1 EntityNotExistsError (com.uber.cadence.EntityNotExistsError)1 InternalServiceError (com.uber.cadence.InternalServiceError)1 WorkflowExecution (com.uber.cadence.WorkflowExecution)1