Skip to content

Commit 70c30aa

Browse files
Bump Protocol V5 (#461)
1 parent 5be39b7 commit 70c30aa

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

sdk-core/src/main/java/dev/restate/sdk/core/statemachine/ServiceProtocol.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
public class ServiceProtocol {
1515
public static final Protocol.ServiceProtocolVersion MIN_SERVICE_PROTOCOL_VERSION =
16-
Protocol.ServiceProtocolVersion.V4;
16+
Protocol.ServiceProtocolVersion.V5;
1717
public static final Protocol.ServiceProtocolVersion MAX_SERVICE_PROTOCOL_VERSION =
18-
Protocol.ServiceProtocolVersion.V4;
18+
Protocol.ServiceProtocolVersion.V5;
1919

2020
static final String CONTENT_TYPE = "content-type";
2121

@@ -37,6 +37,9 @@ static Protocol.ServiceProtocolVersion parseServiceProtocolVersion(String versio
3737
if (version.equals("application/vnd.restate.invocation.v4")) {
3838
return Protocol.ServiceProtocolVersion.V4;
3939
}
40+
if (version.equals("application/vnd.restate.invocation.v5")) {
41+
return Protocol.ServiceProtocolVersion.V5;
42+
}
4043
return Protocol.ServiceProtocolVersion.SERVICE_PROTOCOL_VERSION_UNSPECIFIED;
4144
}
4245

@@ -53,6 +56,9 @@ static String serviceProtocolVersionToHeaderValue(Protocol.ServiceProtocolVersio
5356
if (Objects.requireNonNull(version) == Protocol.ServiceProtocolVersion.V4) {
5457
return "application/vnd.restate.invocation.v4";
5558
}
59+
if (Objects.requireNonNull(version) == Protocol.ServiceProtocolVersion.V5) {
60+
return "application/vnd.restate.invocation.v5";
61+
}
5662
throw new IllegalArgumentException(
5763
String.format("Service protocol version '%s' has no header value", version.getNumber()));
5864
}

sdk-core/src/main/java/dev/restate/sdk/core/statemachine/Util.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static Protocol.ErrorMessage toErrorMessage(
6363
StringWriter sw = new StringWriter();
6464
PrintWriter pw = new PrintWriter(sw);
6565
throwable.printStackTrace(pw);
66-
msg.setDescription(sw.toString());
66+
msg.setStacktrace(sw.toString());
6767

6868
// Add journal entry info
6969
if (currentCommandIndex >= 0) {

sdk-core/src/main/service-protocol/dev/restate/service/protocol.proto

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ enum ServiceProtocolVersion {
2121
// Added
2222
// * Entry retry mechanism: ErrorMessage.next_retry_delay, StartMessage.retry_count_since_last_stored_entry and StartMessage.duration_since_last_stored_entry
2323
V2 = 2;
24-
// Added
25-
// * New entry to cancel invocations: CancelInvocationEntryMessage
26-
// * New entry to retrieve the invocation id: GetCallInvocationIdEntryMessage
27-
// * New field to set idempotency key for Call entries
28-
// * New entry to attach to existing invocation: AttachInvocationEntryMessage
29-
// * New entry to get output of existing invocation: GetInvocationOutputEntryMessage
24+
// **Yanked**
3025
V3 = 3;
31-
// Immutable journal.
26+
// **Yanked**
3227
V4 = 4;
28+
// Immutable journal. Added:
29+
// * New command to cancel invocations
30+
// * Both Call and Send commands now return an additional notification to return the invocation id
31+
// * New field to set idempotency key for Call/Send commands
32+
// * New command to attach to existing invocation
33+
// * New command to get output of existing invocation
34+
V5 = 5;
3335
}
3436

3537
// --- Core frames ---
@@ -94,8 +96,8 @@ message ErrorMessage {
9496
uint32 code = 1;
9597
// Contains a concise error message, e.g. Throwable#getMessage() in Java.
9698
string message = 2;
97-
// Contains a verbose error description, e.g. the exception stacktrace.
98-
string description = 3;
99+
// The exception stacktrace, if available.
100+
string stacktrace = 3;
99101

100102
// Command that caused the failure. This may be outside the current stored journal size.
101103
// If no specific entry caused the failure, the current replayed/processed entry can be used.

sdk-core/src/test/java/dev/restate/sdk/core/AssertUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ public static Consumer<? super MessageLite> exactErrorMessage(Throwable e) {
5656
.returns(e.getMessage(), Protocol.ErrorMessage::getMessage)
5757
.returns(
5858
TerminalException.INTERNAL_SERVER_ERROR_CODE, Protocol.ErrorMessage::getCode)
59-
.extracting(Protocol.ErrorMessage::getDescription, STRING)
59+
.extracting(Protocol.ErrorMessage::getStacktrace, STRING)
6060
.startsWith(e.getClass().getName()));
6161
}
6262

6363
public static Consumer<? super MessageLite> errorDescriptionStartingWith(String str) {
6464
return errorMessage(
6565
msg ->
6666
assertThat(msg)
67-
.extracting(Protocol.ErrorMessage::getDescription, STRING)
67+
.extracting(Protocol.ErrorMessage::getStacktrace, STRING)
6868
.startsWith(str));
6969
}
7070

@@ -73,7 +73,7 @@ public static Consumer<? super MessageLite> protocolExceptionErrorMessage(int co
7373
msg ->
7474
assertThat(msg)
7575
.returns(code, Protocol.ErrorMessage::getCode)
76-
.extracting(Protocol.ErrorMessage::getDescription, STRING)
76+
.extracting(Protocol.ErrorMessage::getStacktrace, STRING)
7777
.startsWith(ProtocolException.class.getCanonicalName()));
7878
}
7979

sdk-core/src/test/java/dev/restate/sdk/core/StateTestSuite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public Stream<TestDefinitions.TestDefinition> definitions() {
100100
errorMessage(
101101
errorMessage ->
102102
assertThat(errorMessage)
103-
.extracting(Protocol.ErrorMessage::getDescription, STRING)
103+
.extracting(Protocol.ErrorMessage::getStacktrace, STRING)
104104
.startsWith(NullPointerException.class.getName()))))
105105
.named("Set null state"));
106106
}

0 commit comments

Comments
 (0)