Implement a lightweight event bus system for SEED architecture: Core Library (models/event_bus.py): - Event dataclass with id, topic, payload, source, timestamp, correlation_id - FileEventStore: JSON lines file-based storage with per-topic files - RedisEventStore: optional Redis pub/sub backend (auto-fallback) - EventBus: high-level API with publish/subscribe/query/replay - File polling for real-time event delivery - Thread-safe concurrent publish support - CLI entry point with subcommands CLI Tool (cli/event_bus_cli.py): - publish: publish events with JSON payload - subscribe: listen for events on a topic - history: query event history with filters - replay: replay events from a timestamp with configurable speed - topics: list available topics - clear: clear event history Tests (tests/test_event_bus.py): 45 tests covering - Event creation, serialization, validation, roundtrip - File store append, read, filters, clear operations - EventBus publish/subscribe/unsubscribe - History queries with topic/source/time filters - Event replay with pacing - Concurrent publish safety - Edge cases (malformed data, large payloads, unicode) All 64 tests pass (45 new + 19 existing).
10 KiB
10 KiB