use of com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes in project cadence-client by uber-java.
the class StateMachines method completeExternalSignal.
private static void completeExternalSignal(RequestContext ctx, SignalExternalData data, String runId, long notUsed) {
SignalExternalWorkflowExecutionInitiatedEventAttributes initiatedEvent = data.initiatedEvent;
WorkflowExecution signaledExecution = initiatedEvent.getWorkflowExecution().deepCopy().setRunId(runId);
ExternalWorkflowExecutionSignaledEventAttributes a = new ExternalWorkflowExecutionSignaledEventAttributes().setInitiatedEventId(data.initiatedEventId).setWorkflowExecution(signaledExecution).setControl(initiatedEvent.getControl()).setDomain(initiatedEvent.getDomain());
HistoryEvent event = new HistoryEvent().setEventType(EventType.ExternalWorkflowExecutionSignaled).setExternalWorkflowExecutionSignaledEventAttributes(a);
ctx.addEvent(event);
}
use of com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes in project cadence-client by uber-java.
the class StateMachines method initiateExternalSignal.
private static void initiateExternalSignal(RequestContext ctx, SignalExternalData data, SignalExternalWorkflowExecutionDecisionAttributes d, long decisionTaskCompletedEventId) {
SignalExternalWorkflowExecutionInitiatedEventAttributes a = new SignalExternalWorkflowExecutionInitiatedEventAttributes();
a.setDecisionTaskCompletedEventId(decisionTaskCompletedEventId);
if (d.isSetControl()) {
a.setControl(d.getControl());
}
if (d.isSetInput()) {
a.setInput(d.getInput());
}
if (d.isSetDomain()) {
a.setDomain(d.getDomain());
}
if (d.isSetChildWorkflowOnly()) {
a.setChildWorkflowOnly(d.isChildWorkflowOnly());
}
a.setSignalName(d.getSignalName());
a.setWorkflowExecution(d.getExecution());
HistoryEvent event = new HistoryEvent().setEventType(EventType.SignalExternalWorkflowExecutionInitiated).setSignalExternalWorkflowExecutionInitiatedEventAttributes(a);
long initiatedEventId = ctx.addEvent(event);
ctx.onCommit((historySize) -> {
data.initiatedEventId = initiatedEventId;
data.initiatedEvent = a;
});
}
use of com.uber.cadence.SignalExternalWorkflowExecutionInitiatedEventAttributes 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.SignalExternalWorkflowExecutionInitiatedEventAttributes in project cadence-client by uber-java.
the class DecisionsHelper method handleSignalExternalWorkflowExecutionInitiated.
void handleSignalExternalWorkflowExecutionInitiated(HistoryEvent event) {
SignalExternalWorkflowExecutionInitiatedEventAttributes attributes = event.getSignalExternalWorkflowExecutionInitiatedEventAttributes();
String signalId = new String(attributes.getControl(), StandardCharsets.UTF_8);
signalInitiatedEventIdToSignalId.put(event.getEventId(), signalId);
DecisionStateMachine decision = getDecision(new DecisionId(DecisionTarget.SIGNAL, signalId));
decision.handleInitiatedEvent(event);
}
Aggregations