edx-event-bus-redis
raw JSON → 1.0.0 verified Fri May 01 auth: no python
Redis Streams implementation for the Open edX event bus. Provides classes like RedisEventBus to produce and consume events over Redis streams. Current version 1.0.0, requires Python >=3.12. Release cadence is irregular, driven by requirements maintenance and occasional breaking changes.
pip install edx-event-bus-redis Common errors
error ModuleNotFoundError: No module named 'edx_event_bus_redis' ↓
cause Package not installed or imported incorrectly.
fix
Run: pip install edx-event-bus-redis
error AttributeError: module 'edx_event_bus_redis' has no attribute 'RedisEventBus' ↓
cause Attempting to import from a submodule instead of the package top level.
fix
Use: from edx_event_bus_redis import RedisEventBus
error redis.exceptions.ConnectionError: Error 61 connecting to localhost:6379. Connection refused. ↓
cause Redis server is not running or unreachable.
fix
Start Redis: redis-server or set REDIS_URL to a valid endpoint.
error TypeError: consume() got an unexpected keyword argument 'signal' ↓
cause Code written for <0.3.0 passed signal parameter; removed in v0.3.0.
fix
Remove the signal argument from consume() calls.
Warnings
breaking v1.0.0 drops Python 3.11 support. Must use Python >=3.12. ↓
fix Upgrade Python environment to 3.12 or later.
breaking v0.3.0 removed the deprecated signal parameter from the consumer. Code relying on that parameter will break. ↓
fix Remove the signal argument from consumer calls.
gotcha Ensure Redis is running and accessible at the configured URL. Misconfiguration leads to silent failures or ConnectionError. ↓
fix Verify REDIS_URL or default url points to a valid Redis instance.
gotcha Event bus configuration must match between producer and consumer (stream names, consumer groups). Mismatch results in no events being consumed. ↓
fix Use consistent stream names and group IDs across services.
Imports
- RedisEventBus
from edx_event_bus_redis import RedisEventBus - EventBusProducer wrong
from edx_event_bus_redis.producer import RedisEventBuscorrectfrom edx.event_bus.redis import RedisEventBus - EventBusConsumer wrong
from edx.event_bus.kafka import KafkaEventBuscorrectfrom edx_event_bus_redis import RedisEventBus
Quickstart
import os
from edx_event_bus_redis import RedisEventBus
redis_url = os.environ.get('REDIS_URL', 'redis://localhost:6379/0')
bus = RedisEventBus(url=redis_url)
# Produce an event
bus.send('user.registered', {'user_id': 42, 'email': 'test@example.com'})
# Consume events (blocking example)
for event in bus.consume(['user.registered']):
print(event)
break