Skip to content

Commit

Permalink
feat: update topic names for events (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto authored Oct 5, 2023
1 parent 846dcfd commit b2f103e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions edx_exams/apps/core/signals/handlers.py
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -10,6 +11,8 @@
EXAM_ATTEMPT_VERIFIED
)

topic_name = getattr(settings, 'EXAM_ATTEMPT_EVENTS_KAFKA_TOPIC_NAME', '')


@receiver(EXAM_ATTEMPT_SUBMITTED)
def listen_for_exam_attempt_submitted(sender, signal, **kwargs): # pylint: disable=unused-argument
Expand All @@ -18,7 +21,7 @@ def listen_for_exam_attempt_submitted(sender, signal, **kwargs): # pylint: disa
"""
get_producer().send(
signal=EXAM_ATTEMPT_SUBMITTED,
topic='exam-attempt-submitted',
topic=topic_name,
event_key_field='exam_attempt.course_key',
event_data={'exam_attempt': kwargs['exam_attempt']},
event_metadata=kwargs['metadata'],
Expand All @@ -32,7 +35,7 @@ def listen_for_exam_attempt_verified(sender, signal, **kwargs): # pylint: disab
"""
get_producer().send(
signal=EXAM_ATTEMPT_VERIFIED,
topic='exam-attempt-verified',
topic=topic_name,
event_key_field='exam_attempt.course_key',
event_data={'exam_attempt': kwargs['exam_attempt']},
event_metadata=kwargs['metadata'],
Expand All @@ -46,7 +49,7 @@ def listen_for_exam_attempt_rejected(sender, signal, **kwargs): # pylint: disab
"""
get_producer().send(
signal=EXAM_ATTEMPT_REJECTED,
topic='exam-attempt-rejected',
topic=topic_name,
event_key_field='exam_attempt.course_key',
event_data={'exam_attempt': kwargs['exam_attempt']},
event_metadata=kwargs['metadata'],
Expand All @@ -60,7 +63,7 @@ def listen_for_exam_attempt_errored(sender, signal, **kwargs): # pylint: disabl
"""
get_producer().send(
signal=EXAM_ATTEMPT_ERRORED,
topic='exam-attempt-errored',
topic=topic_name,
event_key_field='exam_attempt.course_key',
event_data={'exam_attempt': kwargs['exam_attempt']},
event_metadata=kwargs['metadata'],
Expand Down
3 changes: 3 additions & 0 deletions edx_exams/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

0 comments on commit b2f103e

Please sign in to comment.