use of com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes in project cadence-client by uber-java.
the class TestWorkflowMutableStateImpl method processCompleteWorkflowExecution.
private void processCompleteWorkflowExecution(RequestContext ctx, CompleteWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedId) throws InternalServiceError {
workflow.action(StateMachines.Action.COMPLETE, ctx, d, decisionTaskCompletedId);
if (parent.isPresent()) {
// unlocked by the parent
ctx.lockTimer();
ChildWorkflowExecutionCompletedEventAttributes a = new ChildWorkflowExecutionCompletedEventAttributes().setResult(d.getResult()).setDomain(ctx.getDomain()).setWorkflowExecution(ctx.getExecution()).setWorkflowType(startRequest.getWorkflowType());
ForkJoinPool.commonPool().execute(() -> {
try {
parent.get().childWorkflowCompleted(ctx.getExecutionId().getWorkflowId().getWorkflowId(), a);
} catch (EntityNotExistsError entityNotExistsError) {
// Parent might already close
} catch (BadRequestError | InternalServiceError e) {
log.error("Failure reporting child completion", e);
}
});
}
}
use of com.uber.cadence.ChildWorkflowExecutionCompletedEventAttributes in project cadence-client by uber-java.
the class WorkflowDecisionContext method handleChildWorkflowExecutionCompleted.
void handleChildWorkflowExecutionCompleted(HistoryEvent event) {
ChildWorkflowExecutionCompletedEventAttributes attributes = event.getChildWorkflowExecutionCompletedEventAttributes();
WorkflowExecution execution = attributes.getWorkflowExecution();
String workflowId = execution.getWorkflowId();
if (decisions.handleChildWorkflowExecutionClosed(workflowId)) {
OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.remove(workflowId);
if (scheduled != null) {
BiConsumer<byte[], Exception> completionCallback = scheduled.getCompletionCallback();
byte[] result = attributes.getResult();
completionCallback.accept(result, null);
}
}
}
Aggregations