diff --git a/edx_exams/apps/core/signals/handlers.py b/edx_exams/apps/core/signals/handlers.py index 4d74d575..a0b1db45 100644 --- a/edx_exams/apps/core/signals/handlers.py +++ b/edx_exams/apps/core/signals/handlers.py @@ -1,6 +1,7 @@ """ Signal handlers for the edx-exams application. """ +from django.conf import settings from django.dispatch import receiver from openedx_events.event_bus import get_producer from openedx_events.learning.signals import ( @@ -18,7 +19,7 @@ def listen_for_exam_attempt_submitted(sender, signal, **kwargs): # pylint: disa """ get_producer().send( signal=EXAM_ATTEMPT_SUBMITTED, - topic='exam-attempt-submitted', + topic=getattr(settings, 'EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME', ''), event_key_field='exam_attempt.course_key', event_data={'exam_attempt': kwargs['exam_attempt']}, event_metadata=kwargs['metadata'], @@ -32,7 +33,7 @@ def listen_for_exam_attempt_verified(sender, signal, **kwargs): # pylint: disab """ get_producer().send( signal=EXAM_ATTEMPT_VERIFIED, - topic='exam-attempt-verified', + topic=getattr(settings, 'EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME', ''), event_key_field='exam_attempt.course_key', event_data={'exam_attempt': kwargs['exam_attempt']}, event_metadata=kwargs['metadata'], @@ -46,7 +47,7 @@ def listen_for_exam_attempt_rejected(sender, signal, **kwargs): # pylint: disab """ get_producer().send( signal=EXAM_ATTEMPT_REJECTED, - topic='exam-attempt-rejected', + topic=getattr(settings, 'EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME', ''), event_key_field='exam_attempt.course_key', event_data={'exam_attempt': kwargs['exam_attempt']}, event_metadata=kwargs['metadata'], @@ -60,7 +61,7 @@ def listen_for_exam_attempt_errored(sender, signal, **kwargs): # pylint: disabl """ get_producer().send( signal=EXAM_ATTEMPT_ERRORED, - topic='exam-attempt-errored', + topic=getattr(settings, 'EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME', ''), event_key_field='exam_attempt.course_key', event_data={'exam_attempt': kwargs['exam_attempt']}, event_metadata=kwargs['metadata'], diff --git a/edx_exams/settings/base.py b/edx_exams/settings/base.py index c4c86c17..2b5aae05 100644 --- a/edx_exams/settings/base.py +++ b/edx_exams/settings/base.py @@ -277,3 +277,6 @@ def root(*path_fragments): LEARNING_MICROFRONTEND_URL = None EXAMS_DASHBOARD_MFE_URL = None + +# Event Bus Settings +EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME = 'learning-exam-attempt-lifecycle'