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
Copy file name to clipboardExpand all lines: docs/api/appending-events.md
+11-65Lines changed: 11 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,38 +146,6 @@ This feature is only available in KurrentDB 25.1 and later.
146
146
147
147
You can append events to multiple streams in a single atomic operation. Either all streams are updated, or the entire operation fails.
148
148
149
-
The `MultiStreamAppendAsync` method accepts a collection of `AppendStreamRequest` objects and returns a `MultiAppendWriteResult`. Each `AppendStreamRequest` contains:
150
-
151
-
-**Stream** - The name of the stream
152
-
-**ExpectedState** - The expected state of the stream for optimistic concurrency control
153
-
-**Messages** - A collection of `EventData` objects to append
154
-
155
-
The operation returns either:
156
-
-`MultiAppendSuccess` - Successful append results for all streams
157
-
-`MultiAppendFailure` - Specific exceptions for any failed operations
158
-
159
-
::: warning
160
-
Event metadata in `EventData` must currently be valid JSON that can be deserialized into a
161
-
`Dictionary<string, object?>`. This means any metadata you attach to an event should be structured as a JSON object, not as a primitive value or array.
This requirement ensures compatibility with KurrentDB's current metadata handling. In a future major release, this restriction will be lifted, allowing more flexible metadata formats.
177
-
:::
178
-
179
-
Here's a basic example of appending events to multiple streams:
if (resultisMultiAppendSuccess { Successes: varsuccesses })
204
-
foreach (variteminsuccesses)
205
-
Console.WriteLine($"Stream '{item.Stream}' updated at position {item.Position}");
169
+
awaitclient.MultiStreamAppendAsync(requests);
206
170
```
207
171
208
-
If the operation doesn't succeed, you should check if the result is a `MultiAppendFailure` and handle each failure case appropriately. This allows you to respond to specific errors, such as version conflicts, access issues, deleted streams, or transaction size limits. For example:
172
+
The result returns the position of the last appended record in the transaction and a collection of responses for each stream appended in the transaction.
209
173
174
+
::: warning
175
+
If you are storing metadata, it must currently be a valid JSON that can be deserialized into a
176
+
`Dictionary<string, object?>`. This means any metadata you attach to an event should be structured as a JSON object, not as a primitive value or array.
177
+
178
+
When reading those events you can use the metadata decoder utility class to decode your metadata:
0 commit comments