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
XINFOfields - support
XCFGSET - fix test delta in
XTRIMin 8.6
Design choices:
iid/pidforXADDare represented by a newreadonly struct StreamIdempotentIdwhich replaces the usualRedisValue? 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 (contrastRedisValue).- the configuration settings for
XCFGSETare represented by a newclass StreamConfiguration, since it is a variadic settings API, and we don't know how many additional options may be added in the future