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
- Implement idempotent stream entry (IDMP) support ([#3006 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3006))
12
+
9
13
## 2.10.14
10
14
11
15
- Fix bug with connection startup failing in low-memory scenarios ([#3002 by nathan-miller23](https://github.com/StackExchange/StackExchange.Redis/pull/3002))
From Redis 8.6, streams support idempotent write-at-most-once production. This is achieved by passing a `StreamIdempotentId` to the `StreamAdd` method. Using idempotent ids avoids
44
+
duplicate entries in the stream, even in the event of a failure and retry.
45
+
46
+
The `StreamIdempotentId` contains a producer id and an optional idempotent id. The producer id should be unique for a given data generator and should be stable and consistent between runs.
47
+
The optional idempotent id should be unique for a given data item. If the idempotent id is not provided, the server will generate it from the content of the data item.
48
+
49
+
```csharp
50
+
// int someUniqueExternalSourceId = ... // optional
~~~~The `StreamConfigure` method can be used to configure the stream, in particular the IDMP map. The `StreamConfiguration` class has properties for the idempotent producer (IDMP) duration and max-size.
/// Adds an entry using the specified values to the given stream key.
2668
+
/// If key does not exist, a new key holding a stream is created.
2669
+
/// The command returns the ID of the newly created stream entry, using
2670
+
/// the idempotent id (pid/iid) mechanism to ensure at-most-once production.
2671
+
/// See <see cref="StreamIdempotentId"/> for more information of the idempotent API.
2672
+
/// </summary>
2673
+
/// <param name="key">The key of the stream.</param>
2674
+
/// <param name="streamField">The field name for the stream entry.</param>
2675
+
/// <param name="streamValue">The value to set in the stream entry.</param>
2676
+
/// <param name="idempotentId">The idempotent producer (pid) and optionally id (iid) to use for this entry.</param>
2677
+
/// <param name="maxLength">The maximum length of the stream.</param>
2678
+
/// <param name="useApproximateMaxLength">If true, the "~" argument is used to allow the stream to exceed max length by a small number. This improves performance when removing messages.</param>
2679
+
/// <param name="limit">Specifies the maximal count of entries that will be evicted.</param>
2680
+
/// <param name="trimMode">Determines how stream trimming should be performed.</param>
2681
+
/// <param name="flags">The flags to use for this operation.</param>
2682
+
/// <returns>The ID of the newly created message.</returns>
/// Adds an entry using the specified values to the given stream key.
2706
+
/// If key does not exist, a new key holding a stream is created.
2707
+
/// The command returns the ID of the newly created stream entry, using
2708
+
/// the idempotent id (pid/iid) mechanism to ensure at-most-once production.
2709
+
/// See <see cref="StreamIdempotentId"/> for more information of the idempotent API.
2710
+
/// </summary>
2711
+
/// <param name="key">The key of the stream.</param>
2712
+
/// <param name="streamPairs">The fields and their associated values to set in the stream entry.</param>
2713
+
/// <param name="idempotentId">The idempotent producer (pid) and optionally id (iid) to use for this entry.</param>
2714
+
/// <param name="maxLength">The maximum length of the stream.</param>
2715
+
/// <param name="useApproximateMaxLength">If true, the "~" argument is used to allow the stream to exceed max length by a small number. This improves performance when removing messages.</param>
2716
+
/// <param name="limit">Specifies the maximal count of entries that will be evicted.</param>
2717
+
/// <param name="trimMode">Determines how stream trimming should be performed.</param>
2718
+
/// <param name="flags">The flags to use for this operation.</param>
2719
+
/// <returns>The ID of the newly created message.</returns>
0 commit comments