This example shows how to use ModularityKit.Mutator.Governance.Redis as the backing store for governed request writes and query-oriented reads.
It focuses on real Redis-backed request persistence, approval queue reads, and decision/history queries through the same provider.
- connecting to Redis with
ConnectionMultiplexer - registering the Redis governance provider through
AddRedisGovernanceStore(...) - creating governed requests through
IMutationRequestStore - reading pending request queues through
IMutationRequestQueryStore - projecting approval views and decision views from Redis-backed data
- isolating sample data with a dedicated Redis key prefix
You need a running Redis instance.
Default connection:
localhost:6379Override it with a full connection string:
export MODULARITYKIT_REDIS="your-host:6379"Or with separate settings:
export MODULARITYKIT_REDIS_HOST="localhost"
export MODULARITYKIT_REDIS_PORT="6379"
export MODULARITYKIT_REDIS_PASSWORD=""From this folder:
docker compose up -dThis starts a local Redis instance using docker-compose.yml.
Optional overrides:
export MODULARITYKIT_REDIS_PORT="6380"
export MODULARITYKIT_REDIS_PASSWORD="secret"
docker compose up -dStop it with:
docker compose downProgram.csScenarios/GovernanceRedisQueriesScenario.cssrc/Redis/DependencyInjection/RedisGovernanceServiceCollectionExtensions.cssrc/Redis/Storage/RedisMutationRequestStore.cs
dotnet run --project Examples/Governance/RedisQueries/RedisQueries.csproj -c ReleaseThe sample prints:
- the Redis connection and key prefix used by the run
- pending approval queue entries
- approval views filtered by approver
- recent decision views for execution outcomes