Search in sources :

Example 1 with ChildWorkflowExecutionTimedOutEventAttributes

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);
}
Also used : StartChildWorkflowExecutionInitiatedEventAttributes(com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent) ChildWorkflowExecutionTimedOutEventAttributes(com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)

Example 2 with ChildWorkflowExecutionTimedOutEventAttributes

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);
    }
}
Also used : InternalServiceError(com.uber.cadence.InternalServiceError) EntityNotExistsError(com.uber.cadence.EntityNotExistsError) BadRequestError(com.uber.cadence.BadRequestError) ChildWorkflowExecutionTimedOutEventAttributes(com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)

Example 3 with ChildWorkflowExecutionTimedOutEventAttributes

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);
        }
    }
}
Also used : WorkflowExecution(com.uber.cadence.WorkflowExecution) ChildWorkflowTimedOutException(com.uber.cadence.workflow.ChildWorkflowTimedOutException) ChildWorkflowExecutionTimedOutEventAttributes(com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes) 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

ChildWorkflowExecutionTimedOutEventAttributes (com.uber.cadence.ChildWorkflowExecutionTimedOutEventAttributes)3 BadRequestError (com.uber.cadence.BadRequestError)1 EntityNotExistsError (com.uber.cadence.EntityNotExistsError)1 HistoryEvent (com.uber.cadence.HistoryEvent)1 InternalServiceError (com.uber.cadence.InternalServiceError)1 StartChildWorkflowExecutionInitiatedEventAttributes (com.uber.cadence.StartChildWorkflowExecutionInitiatedEventAttributes)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