Skip to content

Commit 620db19

Browse files
gvdongengithub-actions[bot]
authored andcommitted
chore: sync java-api-and-pitfalls.md from docs-restate
1 parent f907b6f commit 620db19

4 files changed

Lines changed: 60 additions & 0 deletions

File tree

java/templates/java-gradle/.aiassistant/rules/java-api-and-pitfalls.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,21 @@ Note: the Java SDK uses `TerminalException`, NOT `TerminalError` (which is used
431431

432432
Any other exception type causes automatic retries with exponential backoff. For retry policy configuration, refer to the retry guide.
433433

434+
### TerminalException metadata
435+
436+
You can attach a string metadata map to a `TerminalException`. The metadata is propagated to callers and accessible via `getMetadata()`. Requires Restate Server >= 1.6.
437+
438+
```java
439+
throw new TerminalException("Something went wrong", Map.of("correlationId", correlationId));
440+
```
441+
442+
Callers can read the metadata:
443+
444+
```java
445+
Map<String, String> metadata = e.getMetadata();
446+
String correlationId = metadata.get("correlationId");
447+
```
448+
434449
---
435450

436451
## SDK Clients (External Invocations)

java/templates/java-maven-quarkus/.aiassistant/rules/java-api-and-pitfalls.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,21 @@ Note: the Java SDK uses `TerminalException`, NOT `TerminalError` (which is used
431431

432432
Any other exception type causes automatic retries with exponential backoff. For retry policy configuration, refer to the retry guide.
433433

434+
### TerminalException metadata
435+
436+
You can attach a string metadata map to a `TerminalException`. The metadata is propagated to callers and accessible via `getMetadata()`. Requires Restate Server >= 1.6.
437+
438+
```java
439+
throw new TerminalException("Something went wrong", Map.of("correlationId", correlationId));
440+
```
441+
442+
Callers can read the metadata:
443+
444+
```java
445+
Map<String, String> metadata = e.getMetadata();
446+
String correlationId = metadata.get("correlationId");
447+
```
448+
434449
---
435450

436451
## SDK Clients (External Invocations)

java/templates/java-maven-spring-boot/.aiassistant/rules/java-api-and-pitfalls.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,21 @@ Note: the Java SDK uses `TerminalException`, NOT `TerminalError` (which is used
431431

432432
Any other exception type causes automatic retries with exponential backoff. For retry policy configuration, refer to the retry guide.
433433

434+
### TerminalException metadata
435+
436+
You can attach a string metadata map to a `TerminalException`. The metadata is propagated to callers and accessible via `getMetadata()`. Requires Restate Server >= 1.6.
437+
438+
```java
439+
throw new TerminalException("Something went wrong", Map.of("correlationId", correlationId));
440+
```
441+
442+
Callers can read the metadata:
443+
444+
```java
445+
Map<String, String> metadata = e.getMetadata();
446+
String correlationId = metadata.get("correlationId");
447+
```
448+
434449
---
435450

436451
## SDK Clients (External Invocations)

java/templates/java-maven/.aiassistant/rules/java-api-and-pitfalls.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,21 @@ Note: the Java SDK uses `TerminalException`, NOT `TerminalError` (which is used
431431

432432
Any other exception type causes automatic retries with exponential backoff. For retry policy configuration, refer to the retry guide.
433433

434+
### TerminalException metadata
435+
436+
You can attach a string metadata map to a `TerminalException`. The metadata is propagated to callers and accessible via `getMetadata()`. Requires Restate Server >= 1.6.
437+
438+
```java
439+
throw new TerminalException("Something went wrong", Map.of("correlationId", correlationId));
440+
```
441+
442+
Callers can read the metadata:
443+
444+
```java
445+
Map<String, String> metadata = e.getMetadata();
446+
String correlationId = metadata.get("correlationId");
447+
```
448+
434449
---
435450

436451
## SDK Clients (External Invocations)

0 commit comments

Comments
 (0)