Search in sources :

Example 1 with StartChildWorkflowFailedException

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

the class WorkflowDecisionContext method handleStartChildWorkflowExecutionFailed.

void handleStartChildWorkflowExecutionFailed(HistoryEvent event) {
    StartChildWorkflowExecutionFailedEventAttributes attributes = event.getStartChildWorkflowExecutionFailedEventAttributes();
    String workflowId = attributes.getWorkflowId();
    if (decisions.handleStartChildWorkflowExecutionFailed(event)) {
        OpenChildWorkflowRequestInfo scheduled = scheduledExternalWorkflows.remove(workflowId);
        if (scheduled != null) {
            WorkflowExecution workflowExecution = new WorkflowExecution();
            workflowExecution.setWorkflowId(workflowId);
            WorkflowType workflowType = attributes.getWorkflowType();
            ChildWorkflowExecutionFailedCause cause = attributes.getCause();
            RuntimeException failure = new StartChildWorkflowFailedException(event.getEventId(), workflowExecution, workflowType, cause);
            BiConsumer<byte[], Exception> completionCallback = scheduled.getCompletionCallback();
            completionCallback.accept(null, failure);
        }
    }
}
Also used : WorkflowType(com.uber.cadence.WorkflowType) StartChildWorkflowFailedException(com.uber.cadence.workflow.StartChildWorkflowFailedException) WorkflowExecution(com.uber.cadence.WorkflowExecution) ChildWorkflowExecutionFailedCause(com.uber.cadence.ChildWorkflowExecutionFailedCause) StartChildWorkflowExecutionFailedEventAttributes(com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes) 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)

Aggregations

ChildWorkflowExecutionFailedCause (com.uber.cadence.ChildWorkflowExecutionFailedCause)1 StartChildWorkflowExecutionFailedEventAttributes (com.uber.cadence.StartChildWorkflowExecutionFailedEventAttributes)1 WorkflowExecution (com.uber.cadence.WorkflowExecution)1 WorkflowType (com.uber.cadence.WorkflowType)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