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);
}
});
}
}
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());
}
}
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);
}
Aggregations