use of com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes 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);
}
use of com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes in project cadence-client by uber-java.
the class TestWorkflowMutableStateImpl method reportWorkflowTimeoutToParent.
private void reportWorkflowTimeoutToParent(RequestContext ctx) {
if (!parent.isPresent()) {
return;
}
try {
ChildWorkflowExecutionTimedOutEventAttributes a = new ChildWorkflowExecutionTimedOutEventAttributes().setTimeoutType(TimeoutType.START_TO_CLOSE).setWorkflowType(startRequest.getWorkflowType()).setDomain(ctx.getDomain()).setWorkflowExecution(ctx.getExecution());
parent.get().childWorklfowTimedOut(ctx.getExecutionId().getWorkflowId().getWorkflowId(), a);
} catch (EntityNotExistsError entityNotExistsError) {
// Parent might already close
} catch (BadRequestError | InternalServiceError e) {
log.error("Failure reporting child timing out", e);
}
}
use of com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes in project cadence-client by uber-java.
the class WorkflowDecisionContext method handleChildWorkflowExecutionTimedOut.
void handleChildWorkflowExecutionTimedOut(HistoryEvent event) {
ChildWorkflowExecutionTimedOutEventAttributes attributes = event.getChildWorkflowExecutionTimedOutEventAttributes();
WorkflowExecution execution = attributes.getWorkflowExecution();
String workflowId = execution.getWorkflowId();
if (decisions.handleChildWorkflowExecutionClosed(workflowId)) {
OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.remove(workflowId);
if (scheduled != null) {
RuntimeException failure = new ChildWorkflowTimedOutException(event.getEventId(), execution, attributes.getWorkflowType());
BiConsumer<byte[], Exception> completionCallback = scheduled.getCompletionCallback();
completionCallback.accept(null, failure);
}
}
}
Aggregations