use of com.uber.cadence.internal.replay.SignalExternalWorkflowParameters in project cadence-client by uber-java.
the class WorkflowStubImpl method signal.
@Override
public void signal(String signalName, Object... input) {
checkStarted();
SignalExternalWorkflowParameters p = new SignalExternalWorkflowParameters();
p.setInput(dataConverter.toData(input));
p.setSignalName(signalName);
p.setWorkflowId(execution.get().getWorkflowId());
// p.setRunId(execution.getRunId());
try {
genericClient.signalWorkflowExecution(p);
} catch (Exception e) {
throw new WorkflowServiceException(execution.get(), workflowType, e);
}
}
use of com.uber.cadence.internal.replay.SignalExternalWorkflowParameters in project cadence-client by uber-java.
the class SyncDecisionContext method signalWorkflow.
Promise<Void> signalWorkflow(WorkflowExecution execution, String signalName, Object... args) {
SignalExternalWorkflowParameters parameters = new SignalExternalWorkflowParameters();
parameters.setSignalName(signalName);
parameters.setWorkflowId(execution.getWorkflowId());
parameters.setRunId(execution.getRunId());
byte[] input = getDataConverter().toData(args);
parameters.setInput(input);
CompletablePromise<Void> result = Workflow.newPromise();
Consumer<Exception> cancellationCallback = context.signalWorkflowExecution(parameters, (output, failure) -> {
if (failure != null) {
runner.executeInWorkflowThread("child workflow failure callback", () -> result.completeExceptionally(mapSignalWorkflowException(failure)));
} else {
runner.executeInWorkflowThread("child workflow completion callback", () -> result.complete(output));
}
});
CancellationScope.current().getCancellationRequest().thenApply((reason) -> {
cancellationCallback.accept(new CancellationException(reason));
return null;
});
return result;
}
use of com.uber.cadence.internal.replay.SignalExternalWorkflowParameters in project cadence-client by uber-java.
the class SyncDecisionContext method signalExternalWorkflow.
@Override
public Promise<Void> signalExternalWorkflow(WorkflowExecution execution, String signalName, Object[] args) {
SignalExternalWorkflowParameters parameters = new SignalExternalWorkflowParameters();
parameters.setSignalName(signalName);
parameters.setWorkflowId(execution.getWorkflowId());
parameters.setRunId(execution.getRunId());
byte[] input = getDataConverter().toData(args);
parameters.setInput(input);
CompletablePromise<Void> result = Workflow.newPromise();
Consumer<Exception> cancellationCallback = context.signalWorkflowExecution(parameters, (output, failure) -> {
if (failure != null) {
runner.executeInWorkflowThread("child workflow failure callback", () -> result.completeExceptionally(mapSignalWorkflowException(failure)));
} else {
runner.executeInWorkflowThread("child workflow completion callback", () -> result.complete(output));
}
});
CancellationScope.current().getCancellationRequest().thenApply((reason) -> {
cancellationCallback.accept(new CancellationException(reason));
return null;
});
return result;
}
use of com.uber.cadence.internal.replay.SignalExternalWorkflowParameters in project cadence-client by uber-java.
the class WorkflowStubImpl method getSignalExternalWorkflowParameters.
private SignalExternalWorkflowParameters getSignalExternalWorkflowParameters(String signalName, Object... input) {
checkStarted();
SignalExternalWorkflowParameters p = new SignalExternalWorkflowParameters();
p.setInput(dataConverter.toData(input));
p.setSignalName(signalName);
p.setWorkflowId(execution.get().getWorkflowId());
// p.setRunId(execution.getRunId());
return p;
}
Aggregations