You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This feature is only available in KurrentDB 25.1 and later.
254
-
:::
252
+
KurrentDB provides two operations for appending events to one or more streams in a single atomic transaction: `appendRecords` and `multiStreamAppend`. Both guarantee that either all writes succeed or the entire operation fails, but they differ in how records are organized, ordered, and validated.
255
253
256
-
You can append events to multiple streams in a single atomic operation. Either all streams are updated, or the entire operation fails.
|**Record ordering**| Interleaved. Records from different streams can be mixed, and their exact order is preserved in the global log. | Grouped. All records for a stream are sent together; ordering across streams is not guaranteed. |
258
+
|**Consistency checks**| Decoupled. Can validate the state of any stream, including streams not being written to. | Coupled. Expected state is specified per stream being written to. |
257
259
258
260
::: warning
259
261
Metadata must be a valid JSON object, using string keys and string values only.
@@ -262,6 +264,88 @@ KurrentDB's metadata handling. This restriction will be lifted in the next major
262
264
release.
263
265
:::
264
266
267
+
### AppendRecords
268
+
269
+
::: note
270
+
This feature is only available in KurrentDB 26.1 and later.
271
+
:::
272
+
273
+
`appendRecords` appends events to one or more streams atomically. Each record specifies which stream it targets, and the exact order of records is preserved in the global log across all streams.
274
+
275
+
#### Single stream
276
+
277
+
The simplest usage appends events to a single stream:
Consistency checks let you validate the state of any stream, including streams you are not writing to, before the append is committed. All checks are evaluated atomically: if any check fails, the entire operation is rejected and an `AppendConsistencyViolationException` is thrown with details about every failing check and the actual state observed.
322
+
323
+
```java
324
+
List<AppendRecord> records =Collections.singletonList(
Because checks are decoupled from writes, you can validate the state of streams you are not writing to, enabling patterns where a business decision depends on the state of multiple streams but the resulting event is written to only one of them.
340
+
341
+
### MultiStreamAppend
342
+
343
+
::: note
344
+
This feature is only available in KurrentDB 25.1 and later.
345
+
:::
346
+
347
+
`multiStreamAppend` appends events to one or more streams atomically. Records are grouped per stream using `AppendStreamRequest`, where each request specifies a stream name, an expected state, and the events for that stream.
0 commit comments