{"id":26924,"library":"edx-event-bus-kafka","title":"edX Event Bus Kafka","description":"Kafka implementation for Open edX event bus. Provides Kafka producer/consumer for publishing and consuming Open edX events. Current version 6.1.0 (supports Django 5.2, Python >=3.8). Release cadence: irregular, ~5-10 releases per year.","status":"active","version":"6.1.0","language":"python","source_language":"en","source_url":"https://github.com/openedx/event-bus-kafka","tags":["open-edx","kafka","event-bus","edx"],"install":[{"cmd":"pip install edx-event-bus-kafka","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for event definitions and serialization.","package":"openedx-events","optional":false},{"reason":"Used by Open edX; event bus integrates with Django settings.","package":"django","optional":false},{"reason":"Async Kafka client.","package":"aiokafka","optional":false}],"imports":[{"note":"Main producer class.","symbol":"KafkaEventProducer","correct":"from edx_event_bus_kafka import KafkaEventProducer"},{"note":"Main consumer class.","symbol":"KafkaEventConsumer","correct":"from edx_event_bus_kafka import KafkaEventConsumer"},{"note":"Factory function for producer.","symbol":"get_producer","correct":"from edx_event_bus_kafka import get_producer"},{"note":"Factory function for consumer.","symbol":"create_consumer","correct":"from edx_event_bus_kafka import create_consumer"}],"quickstart":{"code":"from edx_event_bus_kafka import get_producer, create_consumer\n\n# Producer example\nproducer = get_producer(\n    topic='my-topic',\n    event_type='org.openedx.learning.course.enrollment.completed.v1',\n)\nproducer.send({\n    'user_id': 123,\n    'course_key': 'course-v1:edX+DemoX+Demo_Course',\n})\n\n# Consumer example\nconsumer = create_consumer(\n    topic='my-topic',\n    group_id='my-group',\n)\nfor message in consumer:\n    print(message.value)","lang":"python","description":"Basic produce and consume example."},"warnings":[{"fix":"Use Python 3.9, 3.10, 3.11, or 3.12 (3.12 supported since v6.0.0).","message":"Version 6.0.0 dropped Python 3.8 support. Upgrade to Python 3.9+.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Use public API: KafkaEventProducer, KafkaEventConsumer, get_producer, create_consumer.","message":"The module 'edx_event_bus_kafka.internal' is private and should not be imported directly. Breaking changes may occur without notice.","severity":"deprecated","affected_versions":"all"},{"fix":"Use iteration pattern: for message in consumer: ...","message":"Consumer must be iterated (for message in consumer:) or it will not poll. Calling consumer.poll() manually is not supported in the current API.","severity":"gotcha","affected_versions":"all"},{"fix":"Consult your Open edX instance's event bus configuration for topic naming conventions.","message":"Topic names often require a specific prefix (e.g., 'edx.') depending on the Open edX deployment. Check your platform's configuration.","severity":"gotcha","affected_versions":"all"},{"fix":"Configure via EVENT_BUS_PRODUCER_CONFIG and EVENT_BUS_CONSUMER_CONFIG in Django settings.","message":"The setting EVENT_BUS_KAFKA_ENABLED is being phased out; configuration now uses SERVICE_VARIANT and other Django settings.","severity":"deprecated","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: pip install edx-event-bus-kafka","cause":"Library not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'edx_event_bus_kafka'"},{"fix":"Use: from edx_event_bus_kafka import KafkaEventProducer","cause":"Wrong import path; older versions used different names.","error":"ImportError: cannot import name 'KafkaEventProducer' from 'edx_event_bus_kafka'"},{"fix":"Use create_consumer() or KafkaEventConsumer() which returns an iterable.","cause":"Using an older version or incorrect consumer instantiation.","error":"TypeError: 'Consumer' object is not iterable"},{"fix":"Set KAFKA_BOOTSTRAP_SERVERS environment variable or configure in Django settings as EVENT_BUS_KAFKA_BOOTSTRAP_SERVERS.","cause":"Kafka broker not reachable; check bootstrap servers configuration.","error":"kafka.errors.NoBrokersAvailable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}