Class RedisEventStoreOptions
- Namespace
- Excalibur.EventSourcing.Redis
- Assembly
- Excalibur.EventSourcing.Redis.dll
Configuration options for the Redis event store.
public sealed class RedisEventStoreOptions
- Inheritance
-
RedisEventStoreOptions
- Inherited Members
Properties
ConnectionString
Gets or sets the Redis connection string.
[Required]
public string ConnectionString { get; set; }
Property Value
- string
The Redis connection string.
DatabaseIndex
Gets or sets the Redis database index.
[Range(-1, 15)]
public int DatabaseIndex { get; set; }
Property Value
- int
The database index. Defaults to -1 (default database).
DefaultBatchSize
Gets or sets the default batch size for reading events from Redis streams.
[Range(1, 2147483647)]
public int DefaultBatchSize { get; set; }
Property Value
- int
The default batch size. Defaults to 100.
EventTypeInfoResolver
Gets or sets a source-generated JSON type-info resolver covering the application's domain event types and the runtime types of the values it places in Metadata, enabling a reflection-free serialization path under trimming and native AOT.
public IJsonTypeInfoResolver? EventTypeInfoResolver { get; set; }
Property Value
- IJsonTypeInfoResolver
The consumer's event type-info resolver, or null to serialize through reflection.
Remarks
Domain events are consumer types the framework cannot source-generate, so with no resolver the store serializes them through the reflection-based JsonSerializer. That works under the JIT, but a native-AOT application published with reflection-based serialization disabled has no reflection path to fall back on and the first append fails. Set this to a JsonSerializerContext (or any IJsonTypeInfoResolver) covering those types to remove that dependency.
The stored wire format does not vary with this setting. The resolver supplies type metadata only; the property naming policy, string-enum representation and null handling are the store's own and are applied to whichever resolver is in use, so events written with a resolver are byte-identical to events written without one and remain readable by a host configured either way.
Metadata values are typed object and are therefore written as their runtime type. Declare
each closed value type the application actually stores -- string, int, bool and so
on. Do not declare Dictionary<string, object> as a shortcut: it compiles and then throws on
the values it was meant to cover.
RetryRecognitionWindow
Gets or sets how many of a stream's most recent appends stay recognisable as retries.
[Range(1, 1024)]
public int RetryRecognitionWindow { get; set; }
Property Value
- int
The number of recent appends per stream that remain recognisable. Defaults to 64.
Remarks
An append reports success if and only if its events are durably present, decided by the identity of the events rather than by a version slot, so a retry after a lost acknowledgement is answered with the version the earlier attempt reached instead of a conflict that would invite a duplicating re-append. A Redis stream offers no keyed read by event identifier, so the store instead records the identity of each append in a companion sorted set and looks the retry up there. This is the size of that set.
A retry of any of the last N appends to a stream is recognised, however many other writers appended in between. A retry older than that is reported as a concurrency conflict — the same answer a caller minting fresh identifiers per attempt receives, and the reason a caller must be idempotent downstream rather than relying on this window alone.
The default covers far more intervening appends than a stream receives while one retry is in flight, while staying below the entry count at which Redis abandons the compact encoding for a sorted set, so the memory held per stream stays on the order of a kilobyte. Raise it for streams under unusual contention; lower it only if that per-stream cost matters more than the width of the window.
StreamKeyPrefix
Gets or sets the key prefix for event streams.
public string StreamKeyPrefix { get; set; }
Property Value
- string
The key prefix for event streams. Defaults to "es".