RedisStreamRetentionOptions
What the Redis stream bus keeps: stream entries and consumers.
Entries. Trimming is off by default: an entry stays until it is deleted by hand, so a consumer group that falls behind, or a new group that replays from the start, still finds it. Set at most one of:
maxLength: every
XADDtrims the stream to about this many entries (MAXLEN ~);maxAge: every
XADDtrims entries older than this (MINID ~, from the sender's clock). It must be at least MIN_MAX_AGE and far larger than the clock skew between senders: a sender whose clock runs ahead trims younger entries. Trimming applies to every consumer group: an entry a lagging group has not read yet is lost to it, so size the limit to the slowest group's worst lag. With approximate (the default) Redis trims whole macro nodes, which is much cheaper; the stream may hold a few more entries than the limit. Trimming needs Redis 7.0 or later: it can remove entries still pending for a consumer, and before 7.0 claiming such an entry (XCLAIM) keeps failing.
Consumers. Each subscription start joins its group under a new consumer name, so a restarted node leaves its old consumer behind. When a receiver starts, it deletes (XGROUP DELCONSUMER) the consumers of its group that have no pending entries and have been idle for at least consumerIdleTimeout: deleting a consumer with nothing pending loses nothing, and a live consumer that is deleted is re-created by its next read. null keeps every consumer.