Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public RuntimeException failureToException(
return result;
}

@SuppressWarnings("deprecation") // Continue to check operation id for history compatibility
private RuntimeException failureToExceptionImpl(Failure failure, DataConverter dataConverter) {
Exception cause =
failure.hasCause() ? failureToException(failure.getCause(), dataConverter) : null;
Expand Down Expand Up @@ -217,6 +218,7 @@ public Failure exceptionToFailure(
}

@Nonnull
@SuppressWarnings("deprecation") // Continue to check operation id for history compatibility
private Failure exceptionToFailure(Throwable throwable) {
if (throwable instanceof CheckedExceptionWrapper) {
return exceptionToFailure(throwable.getCause());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private void cancelOperation(OperationContext context, OperationCancelDetails de
}
}

@SuppressWarnings("deprecation") // Continue to check operation id for history compatibility
private CancelOperationResponse handleCancelledOperation(
OperationContext.Builder ctx, CancelOperationRequest task) {
ctx.setService(task.getService()).setOperation(task.getOperation());
Expand Down Expand Up @@ -237,6 +238,7 @@ private OperationStartResult<HandlerResultContent> startOperation(
}
}

@SuppressWarnings("deprecation") // Continue to check operation id for history compatibility
private StartOperationResponse handleStartOperation(
OperationContext.Builder ctx, StartOperationRequest task) {
ctx.setService(task.getService()).setOperation(task.getOperation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ private void cancelNexusOperationCommand() {
completionCallback.apply(Optional.empty(), failure);
}

@SuppressWarnings("deprecation") // Continue to check operation id for history compatibility
private void notifyStarted() {
async = true;
String operationToken =
currentEvent.getNexusOperationStartedEventAttributes().getOperationToken();
// TODO(#2423) Remove support for operationId
String operationId = currentEvent.getNexusOperationStartedEventAttributes().getOperationId();
startedCallback.apply(
Optional.of(operationToken.isEmpty() ? operationId : operationToken), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void startAsyncSyncOperation() throws TimeoutException {
Assert.assertNull(result.getHandlerError());
Assert.assertNotNull(result.getResponse());
Assert.assertEquals(
"test id", result.getResponse().getStartOperation().getAsyncSuccess().getOperationId());
"test id", result.getResponse().getStartOperation().getAsyncSuccess().getOperationToken());
}

@ServiceImpl(service = TestNexusServices.TestNexusService1.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build())
.addWorkflowTask();
long cancelRequestedEventId =
Expand Down Expand Up @@ -196,7 +196,7 @@ protected void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build())
.addWorkflowTask();
long cancelRequestedEventId =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build());
h.addWorkflowTask();
h.add(
Expand Down Expand Up @@ -553,7 +553,7 @@ public void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build());
h.addWorkflowTask();
h.add(
Expand Down Expand Up @@ -645,7 +645,7 @@ public void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build());
h.addWorkflowTask();
h.add(
Expand Down Expand Up @@ -737,7 +737,7 @@ public void buildWorkflow(AsyncWorkflowBuilder<Void> builder) {
NexusOperationStartedEventAttributes.newBuilder()
.setScheduledEventId(scheduledEventId)
.setRequestId("requestId")
.setOperationId(OPERATION_ID)
.setOperationToken(OPERATION_ID)
.build());
h.addWorkflowTask();
h.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ public void testUpdateResets() {
assertEquals("Execute-Hello Update", workflow.update(0, "Hello Update"));

// Reset the workflow
@SuppressWarnings("deprecation")
ResetWorkflowExecutionResponse resetResponse =
workflowClient
.getWorkflowServiceStubs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static final class NexusOperationData {
// Timeout for an individual Start or Cancel Operation request.
final Duration requestTimeout = Durations.fromSeconds(10);

String operationId = "";
String operationToken = "";
Endpoint endpoint;
NexusOperationScheduledEventAttributes scheduledEvent;
TestWorkflowStore.NexusTask nexusTask;
Expand Down Expand Up @@ -739,7 +739,6 @@ private static void startNexusOperation(
.setEventType(EventType.EVENT_TYPE_NEXUS_OPERATION_STARTED)
.setNexusOperationStartedEventAttributes(
NexusOperationStartedEventAttributes.newBuilder()
.setOperationId(resp.getOperationId())
.setOperationToken(resp.getOperationToken())
.setScheduledEventId(data.scheduledEventId)
.setRequestId(data.scheduledEvent.getRequestId()));
Expand All @@ -753,7 +752,7 @@ private static void startNexusOperation(
}

ctx.addEvent(event.build());
ctx.onCommit(historySize -> data.operationId = resp.getOperationId());
ctx.onCommit(historySize -> data.operationToken = resp.getOperationToken());
}

private static void completeNexusOperation(
Expand Down Expand Up @@ -784,7 +783,7 @@ private static void timeoutNexusOperation(
.setEndpoint(data.scheduledEvent.getEndpoint())
.setService(data.scheduledEvent.getService())
.setOperation(data.scheduledEvent.getOperation())
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setScheduledEventId(data.scheduledEventId))
.setCause(
Failure.newBuilder()
Expand Down Expand Up @@ -823,7 +822,7 @@ private static State failNexusOperation(
.setEndpoint(data.scheduledEvent.getEndpoint())
.setService(data.scheduledEvent.getService())
.setOperation(data.scheduledEvent.getOperation())
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setScheduledEventId(data.scheduledEventId)
.build())
.build()))
Expand All @@ -838,7 +837,7 @@ private static State failNexusOperation(
// operation's schedule-to-close timeout, so do not fail the operation here and allow
// it to be timed out by the timer set in
// io.temporal.internal.testservice.TestWorkflowMutableStateImpl.timeoutNexusOperation
return (Strings.isNullOrEmpty(data.operationId)) ? INITIATED : STARTED;
return (Strings.isNullOrEmpty(data.operationToken)) ? INITIATED : STARTED;
}

Failure wrapped =
Expand All @@ -849,7 +848,7 @@ private static State failNexusOperation(
.setEndpoint(data.scheduledEvent.getEndpoint())
.setService(data.scheduledEvent.getService())
.setOperation(data.scheduledEvent.getOperation())
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setScheduledEventId(data.scheduledEventId))
.setCause(failure)
.build();
Expand Down Expand Up @@ -953,7 +952,7 @@ private static void requestCancelNexusOperation(
io.temporal.api.nexus.v1.Request.newBuilder()
.setCancelOperation(
CancelOperationRequest.newBuilder()
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setOperation(data.scheduledEvent.getOperation())
.setService(data.scheduledEvent.getService())));

Expand Down Expand Up @@ -986,7 +985,7 @@ private static void reportNexusOperationCancellation(
.setEndpoint(data.scheduledEvent.getEndpoint())
.setService(data.scheduledEvent.getService())
.setOperation(data.scheduledEvent.getOperation())
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setScheduledEventId(data.scheduledEventId));
if (failure != null) {
wrapped.setCause(failure);
Expand Down Expand Up @@ -1128,7 +1127,6 @@ private static void initiateChildWorkflow(
long workflowTaskCompletedEventId) {
StartChildWorkflowExecutionInitiatedEventAttributes.Builder a =
StartChildWorkflowExecutionInitiatedEventAttributes.newBuilder()
.setControl(d.getControl())
.setInput(d.getInput())
.setWorkflowTaskCompletedEventId(workflowTaskCompletedEventId)
.setNamespace(d.getNamespace().isEmpty() ? ctx.getNamespace() : d.getNamespace())
Expand Down Expand Up @@ -1371,6 +1369,7 @@ private static void completeWorkflow(
ctx.addEvent(event);
}

@SuppressWarnings("deprecation")
private static void continueAsNewWorkflow(
RequestContext ctx,
WorkflowData data,
Expand Down Expand Up @@ -2389,7 +2388,6 @@ private static void initiateExternalSignal(
SignalExternalWorkflowExecutionInitiatedEventAttributes.Builder a =
SignalExternalWorkflowExecutionInitiatedEventAttributes.newBuilder()
.setWorkflowTaskCompletedEventId(workflowTaskCompletedEventId)
.setControl(d.getControl())
.setInput(d.getInput())
.setNamespace(d.getNamespace())
.setChildWorkflowOnly(d.getChildWorkflowOnly())
Expand Down Expand Up @@ -2419,7 +2417,6 @@ private static void failExternalSignal(
SignalExternalWorkflowExecutionFailedEventAttributes.newBuilder()
.setInitiatedEventId(data.initiatedEventId)
.setWorkflowExecution(initiatedEvent.getWorkflowExecution())
.setControl(initiatedEvent.getControl())
.setCause(cause)
.setNamespace(initiatedEvent.getNamespace());
HistoryEvent event =
Expand All @@ -2439,7 +2436,6 @@ private static void completeExternalSignal(
ExternalWorkflowExecutionSignaledEventAttributes.newBuilder()
.setInitiatedEventId(data.initiatedEventId)
.setWorkflowExecution(signaledExecution)
.setControl(initiatedEvent.getControl())
.setNamespace(initiatedEvent.getNamespace());
HistoryEvent event =
HistoryEvent.newBuilder()
Expand All @@ -2457,7 +2453,6 @@ private static void initiateExternalCancellation(
RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.Builder a =
RequestCancelExternalWorkflowExecutionInitiatedEventAttributes.newBuilder()
.setWorkflowTaskCompletedEventId(workflowTaskCompletedEventId)
.setControl(d.getControl())
.setNamespace(d.getNamespace())
.setChildWorkflowOnly(d.getChildWorkflowOnly())
.setWorkflowExecution(
Expand Down Expand Up @@ -2511,7 +2506,6 @@ private static void failExternalCancellation(
RequestCancelExternalWorkflowExecutionFailedEventAttributes.newBuilder()
.setInitiatedEventId(data.initiatedEventId)
.setWorkflowExecution(initiatedEvent.getWorkflowExecution())
.setControl(initiatedEvent.getControl())
.setCause(cause)
.setNamespace(initiatedEvent.getNamespace());
HistoryEvent event =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,7 @@ public void completeNexusOperation(NexusOperationRef ref, Payload result) {
public void completeAsyncNexusOperation(
NexusOperationRef ref,
Payload result,
String operationID,
String operationToken,
io.temporal.api.nexus.v1.Link startLink) {
update(
ctx -> {
Expand All @@ -2368,7 +2368,7 @@ public void completeAsyncNexusOperation(
// Received completion before start, so fabricate started event.
StartOperationResponse.Async start =
StartOperationResponse.Async.newBuilder()
.setOperationId(operationID)
.setOperationToken(operationToken)
.addLinks(startLink)
.build();
operation.action(Action.START, ctx, start, 0);
Expand Down Expand Up @@ -2487,7 +2487,7 @@ private void retryNexusTask(RequestContext ctx, StateMachine<NexusOperationData>

LockHandle lockHandle =
timerService.lockTimeSkipping(
"nexusOperationRetryTimer " + operation.getData().operationId);
"nexusOperationRetryTimer " + operation.getData().operationToken);
boolean unlockTimer = false;
data.isBackingOff = false;

Expand All @@ -2506,7 +2506,7 @@ private void retryNexusTask(RequestContext ctx, StateMachine<NexusOperationData>
} finally {
if (unlockTimer) {
// Allow time skipping when waiting for an operation retry
lockHandle.unlock("nexusOperationRetryTimer " + operation.getData().operationId);
lockHandle.unlock("nexusOperationRetryTimer " + operation.getData().operationToken);
}
}
},
Expand Down Expand Up @@ -3361,7 +3361,7 @@ private static PendingNexusOperationInfo constructPendingNexusOperationInfo(
.setEndpoint(data.scheduledEvent.getEndpoint())
.setService(data.scheduledEvent.getService())
.setOperation(data.scheduledEvent.getOperation())
.setOperationId(data.operationId)
.setOperationToken(data.operationToken)
.setScheduledEventId(data.scheduledEventId)
.setScheduleToCloseTimeout(data.scheduledEvent.getScheduleToCloseTimeout())
.setState(convertNexusOperationState(sm.getState(), data))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,6 @@ public void signalWithStartWorkflowExecution(
.setSignalName(r.getSignalName())
.setWorkflowExecution(executionId.getExecution())
.setRequestId(r.getRequestId())
.setControl(r.getControl())
.setNamespace(r.getNamespace())
.setIdentity(r.getIdentity())
.addAllLinks(r.getLinksList())
Expand Down Expand Up @@ -1526,6 +1525,7 @@ public void signalExternalWorkflowExecution(
*
* @return RunId
*/
@SuppressWarnings("deprecation")
public String continueAsNew(
StartWorkflowExecutionRequest previousRunStartRequest,
ContinueAsNewWorkflowExecutionCommandAttributes ca,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ private CompletableFuture<Request> completeNexusTask(
.setStartOperation(
StartOperationResponse.newBuilder()
.setAsyncSuccess(
StartOperationResponse.Async.newBuilder().setOperationId(operationId)))
StartOperationResponse.Async.newBuilder().setOperationToken(operationId)))
.build());
}

Expand Down Expand Up @@ -1055,7 +1055,7 @@ private void assertOperationFailureInfo(NexusOperationFailureInfo info) {

private void assertOperationFailureInfo(String operationID, NexusOperationFailureInfo info) {
Assert.assertNotNull(info);
Assert.assertEquals(operationID, info.getOperationId());
Assert.assertEquals(operationID, info.getOperationToken());
Assert.assertEquals(testEndpoint.getSpec().getName(), info.getEndpoint());
Assert.assertEquals(testService, info.getService());
Assert.assertEquals(testOperation, info.getOperation());
Expand Down
Loading