use of com.uber.cadence.ChildWorkflowExecutionFailedEventAttributes in project cadence-client by uber-java.
the class TestWorkflowMutableStateImpl method processFailWorkflowExecution.
private void processFailWorkflowExecution(RequestContext ctx, FailWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedId) throws InternalServiceError {
workflow.action(StateMachines.Action.FAIL, ctx, d, decisionTaskCompletedId);
if (parent.isPresent()) {
// unlocked by the parent
ctx.lockTimer();
ChildWorkflowExecutionFailedEventAttributes a = new ChildWorkflowExecutionFailedEventAttributes().setDetails(d.getDetails()).setReason(d.getReason()).setWorkflowType(startRequest.getWorkflowType()).setDomain(ctx.getDomain()).setWorkflowExecution(ctx.getExecution());
ForkJoinPool.commonPool().execute(() -> {
try {
parent.get().childWorklfowFailed(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.ChildWorkflowExecutionFailedEventAttributes in project cadence-client by uber-java.
the class WorkflowDecisionContext method handleChildWorkflowExecutionFailed.
void handleChildWorkflowExecutionFailed(HistoryEvent event) {
ChildWorkflowExecutionFailedEventAttributes attributes = event.getChildWorkflowExecutionFailedEventAttributes();
WorkflowExecution execution = attributes.getWorkflowExecution();
String workflowId = execution.getWorkflowId();
if (decisions.handleChildWorkflowExecutionClosed(workflowId)) {
OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.remove(workflowId);
if (scheduled != null) {
String reason = attributes.getReason();
byte[] details = attributes.getDetails();
RuntimeException failure = new ChildWorkflowTaskFailedException(event.getEventId(), execution, attributes.getWorkflowType(), reason, details);
BiConsumer<byte[], Exception> completionCallback = scheduled.getCompletionCallback();
completionCallback.accept(null, failure);
}
}
}
Aggregations