Search in sources :

Example 1 with ChildWorkflowTerminatedException

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

the class WorkflowDecisionContext method handleChildWorkflowExecutionTerminated.

void handleChildWorkflowExecutionTerminated(HistoryEvent event) {
    ChildWorkflowExecutionTerminatedEventAttributes attributes = event.getChildWorkflowExecutionTerminatedEventAttributes();
    WorkflowExecution execution = attributes.getWorkflowExecution();
    String workflowId = execution.getWorkflowId();
    if (decisions.handleChildWorkflowExecutionClosed(workflowId)) {
        OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.remove(workflowId);
        if (scheduled != null) {
            RuntimeException failure = new ChildWorkflowTerminatedException(event.getEventId(), execution, attributes.getWorkflowType());
            BiConsumer<byte[], Exception> completionCallback = scheduled.getCompletionCallback();
            completionCallback.accept(null, failure);
        }
    }
}
Also used : WorkflowExecution(com.uber.cadence.WorkflowExecution) StartChildWorkflowFailedException(com.uber.cadence.workflow.StartChildWorkflowFailedException) ChildWorkflowTerminatedException(com.uber.cadence.workflow.ChildWorkflowTerminatedException) CancellationException(java.util.concurrent.CancellationException) ChildWorkflowTimedOutException(com.uber.cadence.workflow.ChildWorkflowTimedOutException) SignalExternalWorkflowException(com.uber.cadence.workflow.SignalExternalWorkflowException) ChildWorkflowExecutionTerminatedEventAttributes(com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes) ChildWorkflowTerminatedException(com.uber.cadence.workflow.ChildWorkflowTerminatedException)

Aggregations

ChildWorkflowExecutionTerminatedEventAttributes (com.uber.cadence.ChildWorkflowExecutionTerminatedEventAttributes)1 WorkflowExecution (com.uber.cadence.WorkflowExecution)1 ChildWorkflowTerminatedException (com.uber.cadence.workflow.ChildWorkflowTerminatedException)1 ChildWorkflowTimedOutException (com.uber.cadence.workflow.ChildWorkflowTimedOutException)1 SignalExternalWorkflowException (com.uber.cadence.workflow.SignalExternalWorkflowException)1 StartChildWorkflowFailedException (com.uber.cadence.workflow.StartChildWorkflowFailedException)1 CancellationException (java.util.concurrent.CancellationException)1