| | | 1 | | namespace AsyncResponse.Channels.Redis; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Options for the Redis async-response channel. Recovery-state expiry, default timeout, and the |
| | | 5 | | /// remote stack-trace policy are inherited from <see cref="DurableAsyncResponseChannelOptions"/>. |
| | | 6 | | /// </summary> |
| | | 7 | | public sealed class RedisAsyncResponseOptions : DurableAsyncResponseChannelOptions |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Prefix for every Redis key and pub/sub channel created by the channel: |
| | | 11 | | /// response channels are <c>{KeyPrefix}:response:{correlationId}</c> and recovery state lives |
| | | 12 | | /// at <c>{KeyPrefix}:recovery:{correlationId}</c>. Change it to isolate multiple |
| | | 13 | | /// applications or environments sharing one Redis. Treat as a deployment-wide contract: |
| | | 14 | | /// publishers and subscribers must agree on it, and changing it orphans existing |
| | | 15 | | /// recovery state. |
| | | 16 | | /// </summary> |
| | 2220 | 17 | | public string KeyPrefix { get; set; } = "asyncresponse"; |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Validates the options, throwing <see cref="InvalidOperationException"/> on a |
| | | 21 | | /// misconfiguration. Called by the channel so a bad configuration fails fast rather than at |
| | | 22 | | /// first use. |
| | | 23 | | /// </summary> |
| | | 24 | | public void Validate() |
| | | 25 | | { |
| | | 26 | | // Shared channel knobs (RecoveryStateExpiry, DefaultTimeout, DisposalDrainTimeout) go |
| | | 27 | | // through the ONE base guard set. |
| | 558 | 28 | | ValidateShared(nameof(RedisAsyncResponseOptions)); |
| | | 29 | | |
| | | 30 | | // Sibling-channel parity: RemoteStackTrace.Cap treats any non-positive cap as "leave the |
| | | 31 | | // trace unchanged", so a negative value (a plausible "unlimited", or a bad configuration |
| | | 32 | | // binding) silently disabled the DoS bound in both directions. The other four channels |
| | | 33 | | // reject it at startup; Redis was the only one that accepted it. |
| | 558 | 34 | | if (MaxRemoteStackTraceLength < 0) |
| | 2 | 35 | | throw new InvalidOperationException($"{nameof(RedisAsyncResponseOptions)}.{nameof(MaxRemoteStackTraceLength) |
| | 556 | 36 | | } |
| | | 37 | | } |