Search in sources :

Example 1 with SignalExternalWorkflowExecutionFailedEventAttributes

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

the class StateMachines method failExternalSignal.

private static void failExternalSignal(RequestContext ctx, SignalExternalData data, SignalExternalWorkflowExecutionFailedCause cause, long notUsed) {
    SignalExternalWorkflowExecutionInitiatedEventAttributes initiatedEvent = data.initiatedEvent;
    SignalExternalWorkflowExecutionFailedEventAttributes a = new SignalExternalWorkflowExecutionFailedEventAttributes().setInitiatedEventId(data.initiatedEventId).setWorkflowExecution(initiatedEvent.getWorkflowExecution()).setControl(initiatedEvent.getControl()).setCause(cause).setDomain(initiatedEvent.getDomain());
    HistoryEvent event = new HistoryEvent().setEventType(EventType.SignalExternalWorkflowExecutionFailed).setSignalExternalWorkflowExecutionFailedEventAttributes(a);
    ctx.addEvent(event);
}
Also used : SignalExternalWorkflowExecutionFailedEventAttributes(com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes) HistoryEvent(com.uber.cadence.HistoryEvent) SignalExternalWorkflowExecutionInitiatedEventAttributes(com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes)

Example 2 with SignalExternalWorkflowExecutionFailedEventAttributes

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

the class WorkflowDecisionContext method handleSignalExternalWorkflowExecutionFailed.

void handleSignalExternalWorkflowExecutionFailed(HistoryEvent event) {
    SignalExternalWorkflowExecutionFailedEventAttributes attributes = event.getSignalExternalWorkflowExecutionFailedEventAttributes();
    String signalId = new String(attributes.getControl(), StandardCharsets.UTF_8);
    if (decisions.handleSignalExternalWorkflowExecutionFailed(signalId)) {
        OpenRequestInfo<Void, Void> signalContextAndResult = scheduledSignals.remove(signalId);
        if (signalContextAndResult != null) {
            WorkflowExecution signaledExecution = new WorkflowExecution();
            signaledExecution.setWorkflowId(attributes.getWorkflowExecution().getWorkflowId());
            signaledExecution.setRunId(attributes.getWorkflowExecution().getRunId());
            RuntimeException failure = new SignalExternalWorkflowException(event.getEventId(), signaledExecution, attributes.getCause());
            signalContextAndResult.getCompletionCallback().accept(null, failure);
        }
    }
}
Also used : SignalExternalWorkflowException(com.uber.cadence.workflow.SignalExternalWorkflowException) SignalExternalWorkflowExecutionFailedEventAttributes(com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes) WorkflowExecution(com.uber.cadence.WorkflowExecution)

Aggregations

SignalExternalWorkflowExecutionFailedEventAttributes (com.uber.cadence.SignalExternalWorkflowExecutionFailedEventAttributes)2 HistoryEvent (com.uber.cadence.HistoryEvent)1 SignalExternalWorkflowExecutionInitiatedEventAttributes (com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes)1 WorkflowExecution (com.uber.cadence.WorkflowExecution)1 SignalExternalWorkflowException (com.uber.cadence.workflow.SignalExternalWorkflowException)1