-
Notifications
You must be signed in to change notification settings - Fork 158
Update Java SDK for Temporal Sever v1.26.2 #2357
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Changes from all commits
87ee953
a5fc15f
0fa02f0
0142f3b
d085112
002841f
7356e2a
97054ec
fd755e3
0f466a5
a021550
398c333
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,17 +58,6 @@ public void syncOperationImmediatelyCancelled() { | |
"operation canceled before it was started", canceledFailure.getOriginalMessage()); | ||
} | ||
|
||
@Test | ||
public void syncOperationCancelled() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed this test since the Server dropped support for cancelling failing sync operations |
||
TestWorkflows.TestWorkflow1 workflowStub = | ||
testWorkflowRule.newWorkflowStubTimeoutOptions(TestWorkflows.TestWorkflow1.class); | ||
WorkflowFailedException exception = | ||
Assert.assertThrows(WorkflowFailedException.class, () -> workflowStub.execute("")); | ||
Assert.assertTrue(exception.getCause() instanceof NexusOperationFailure); | ||
NexusOperationFailure nexusFailure = (NexusOperationFailure) exception.getCause(); | ||
Assert.assertTrue(nexusFailure.getCause() instanceof CanceledFailure); | ||
} | ||
|
||
public static class TestNexus implements TestWorkflows.TestWorkflow1 { | ||
@Override | ||
public String execute(String input) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
|
||
import com.google.common.base.Preconditions; | ||
import com.google.common.base.Strings; | ||
import com.google.protobuf.Any; | ||
import com.google.protobuf.ByteString; | ||
import com.google.protobuf.InvalidProtocolBufferException; | ||
import com.google.protobuf.Timestamp; | ||
|
@@ -86,6 +87,17 @@ | |
import org.slf4j.LoggerFactory; | ||
|
||
class TestWorkflowMutableStateImpl implements TestWorkflowMutableState { | ||
static final Failure FAILED_UPDATE_ON_WF_COMPLETION = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a test confirming that this at least looks mostly like the real server's version? Unsure if Java has tests against actual server and test server with the same code, but I just want to make sure if/when this changes server side we can catch it here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I can do that |
||
Failure.newBuilder() | ||
.setMessage( | ||
"Workflow Update failed because the Workflow completed before the Update completed.") | ||
.setSource("Server") | ||
.setApplicationFailureInfo( | ||
ApplicationFailureInfo.newBuilder() | ||
.setType("AcceptedUpdateCompletedWorkflow") | ||
.setNonRetryable(true) | ||
.build()) | ||
.build(); | ||
|
||
/** | ||
* If the implementation throws an exception, changes accumulated in the RequestContext will not | ||
|
@@ -541,6 +553,7 @@ public void completeWorkflowTask( | |
|| request.getForceCreateNewWorkflowTask())) { | ||
scheduleWorkflowTask(ctx); | ||
} | ||
|
||
workflowTaskStateMachine.getData().bufferedEvents.clear(); | ||
Map<String, ConsistentQuery> queries = data.consistentQueryRequests; | ||
Map<String, WorkflowQueryResult> queryResultsMap = request.getQueryResultsMap(); | ||
|
@@ -1671,6 +1684,27 @@ private void processWorkflowCompletionCallbacks(RequestContext ctx) { | |
return; | ||
} | ||
|
||
updates.forEach( | ||
(k, updateStateMachine) -> { | ||
if (!(updateStateMachine.getState() == StateMachines.State.COMPLETED | ||
|| updateStateMachine.getState() == StateMachines.State.FAILED)) { | ||
updateStateMachine.action( | ||
Action.COMPLETE, | ||
ctx, | ||
Message.newBuilder() | ||
.setBody( | ||
Any.pack( | ||
Response.newBuilder() | ||
.setOutcome( | ||
Outcome.newBuilder() | ||
.setFailure(FAILED_UPDATE_ON_WF_COMPLETION) | ||
.build()) | ||
.build())) | ||
.build(), | ||
completionEvent.get().getEventId()); | ||
} | ||
}); | ||
|
||
for (Callback cb : startRequest.getCompletionCallbacksList()) { | ||
if (!cb.hasNexus()) { | ||
// test server only supports nexus callbacks currently | ||
|
@@ -3101,6 +3135,10 @@ private static PendingActivityInfo constructPendingActivityInfo( | |
builder.setLastWorkerIdentity(activityTaskData.identity); | ||
} | ||
|
||
if (activityTaskData.lastAttemptCompleteTime != null) { | ||
builder.setLastAttemptCompleteTime(activityTaskData.lastAttemptCompleteTime); | ||
} | ||
|
||
// Some ids are only present in the schedule event... | ||
if (activityTaskData.scheduledEvent != null) { | ||
populatePendingActivityInfoFromScheduledEvent(builder, activityTaskData.scheduledEvent); | ||
|
@@ -3145,12 +3183,8 @@ private static void populatePendingActivityInfoFromScheduledEvent( | |
|
||
private static void populatePendingActivityInfoFromPollResponse( | ||
PendingActivityInfo.Builder builder, PollActivityTaskQueueResponseOrBuilder task) { | ||
// In golang, we set one but never both of these fields, depending on the activity state | ||
if (builder.getState() == PendingActivityState.PENDING_ACTIVITY_STATE_SCHEDULED) { | ||
builder.setScheduledTime(task.getScheduledTime()); | ||
} else { | ||
builder.setLastStartedTime(task.getStartedTime()); | ||
} | ||
builder.setScheduledTime(task.getScheduledTime()); | ||
builder.setLastStartedTime(task.getStartedTime()); | ||
} | ||
|
||
private static void populatePendingActivityInfoFromHeartbeatDetails( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked all other SDKs and the Java SDK was the only SDK that was throwing an exception here instead of converting to an application failure