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);
}
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);
}
}
}
Aggregations