Skip to content

BotWire v0.3.0

Choose a tag to compare

@github-actions github-actions released this 17 Jun 09:15

BotWire v0.3.0 — Redis: multi-container support

The Phase 1.6 release makes BotWire correct behind a load balancer. Conversation sessions and rate-limit counters can now live in Redis instead of process memory, so they survive restarts and are shared across every instance. One new opt-in package, one new line of code — defaults are unchanged.

New features

  • BotWire.Redis package — Redis-backed stores wired up with a single call after AddBotWire(...):

    builder.Services.AddBotWire(opts => { /* ... */ })
                    .AddBotWireRedis("localhost:6379");

    Registers a shared IConnectionMultiplexer plus both stores below. Multi-targets net6.0/net8.0/net10.0.

  • RedisConversationStore — conversation sessions persisted to Redis as JSON with a sliding TTL equal to SessionTtl (refreshed on every save). Sessions survive an API restart or load-balancer bounce, so full history is no longer lost when a request lands on a different instance. Dual-history (compressed send-history vs. full history) and all session flags round-trip intact, and the MaxHistoryMessages cap is enforced identically to the in-memory store.

  • Distributed rate limitingMaxMessagesPerMinute, MaxSessionsPerIpPerHour, and DailyTokenBudget are now backed by atomic Redis counters when Redis is configured, so two instances sharing one Redis enforce one shared limit instead of N×. The daily-token-budget key expires at the next UTC midnight. Over-limit behaviours are unchanged (delay / reject / degrade). MaxConcurrentSessions remains per-container by design — a true distributed semaphore leaks permits on container crashes; set it per-replica or disable it.

    Introduced behind an IRateLimitStore abstraction, so BotWire.Core takes no dependency on StackExchange.Redis.

  • RedisShop sample — a two-part multi-container testbed: a RedisShop.Api service (Redis sessions + distributed rate limiting + email escalation) and a Vite + React + TypeScript shopfront with a hand-built chatbox on the headless botwire-js client. See samples/RedisShop/README.md.

Breaking changes

None. Without AddBotWireRedis(...) everything behaves exactly as in v0.2.0 (in-memory stores, per-process counters).

Notes

  • Requires a reachable Redis instance (e.g. Docker Desktop). Redis connection failures surface as errors rather than silently dropping conversation history.
  • Default deployments without Redis are still single-instance: counters and sessions remain per-process and reset on restart.

Get started

dotnet add package BotWire.AspNetCore
dotnet add package BotWire.Redis

See the README for the full quick start and the RedisShop sample for a multi-instance setup.

What's Changed

  • docs: README — 0.2 rate limiting + token audit fields by @adamy in #25
  • chore(deps-dev): bump esbuild from 0.28.0 to 0.28.1 in /npm/botwire-js by @dependabot[bot] in #24
  • docs: restructure README, add botwire-js section, route licensing to … by @adamy in #26
  • feat: Redis multi-container support (Phase 1.6) by @adamy in #28
  • fix: resolve two code-scanning alerts by @adamy in #29
  • chore(deps): bump esbuild and vite in /samples/RedisShop/web by @dependabot[bot] in #30

Full Changelog: v0.2.0...v0.3.0