Support 8.6 idempotent streams by mgravell · Pull Request #3006 · StackExchange/StackExchange.Redis

IDMP is a new server 8.6 feature that allows at-most-once stream additions, via a small tweak to XADD

  • mode 1: XADD ... IDMPAUTO pid * {fields}
  • mode 2: XADD ... IDMP pid iid * {fields}

A pid is a producer identifier - "who sent this?"; the optional iid identifies the individual element, think "source correlation id" - if omitted, it is auto-generated from the payload. Ultimately, if you XADD the same pid/iid combination in IDMP mode, it does not add duplicates; instead, you get back the message-id from the last time you added it.

The tests are guarded to 8.6 which means they don't run on the current CI, since no CI image is yet available. Everything looks fine locally.

  • support XADD IDMP
  • support new XINFO fields
  • support XCFGSET
  • fix test delta in XTRIM in 8.6

Design choices:

  • iid/pid for XADD are represented by a new readonly struct StreamIdempotentId which replaces the usual RedisValue? messageId, since IDMP is only permitted with * as the message-id; this makes the API additions unambiguous, in particular because there are no conversion operations (contrast RedisValue).
  • the configuration settings for XCFGSET are represented by a new class StreamConfiguration, since it is a variadic settings API, and we don't know how many additional options may be added in the future