-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use event producer config #33269
Changes from all commits
b46d149
b0f157f
e92bd61
8f6b642
9c0cf67
2f96f8a
982b224
bf8224f
19363a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -301,23 +301,10 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing | |
CREDENTIALS_PUBLIC_SERVICE_URL = 'http://localhost:18150' | ||
|
||
#################### Event bus backend ######################## | ||
# .. toggle_name: FEATURES['ENABLE_SEND_XBLOCK_EVENTS_OVER_BUS'] | ||
# .. toggle_implementation: DjangoSetting | ||
# .. toggle_default: False | ||
# .. toggle_description: Temporary configuration which enables sending xblock events over the event bus. | ||
# .. toggle_use_cases: open_edx | ||
# .. toggle_creation_date: 2023-02-21 | ||
# .. toggle_warning: For consistency in user experience, keep the value in sync with the setting of the same name | ||
# in the LMS and CMS. | ||
# .. toggle_tickets: 'https://github.com/openedx/edx-platform/pull/31813' | ||
FEATURES['ENABLE_SEND_XBLOCK_EVENTS_OVER_BUS'] = True | ||
FEATURES['ENABLE_SEND_ENROLLMENT_EVENTS_OVER_BUS'] = True | ||
EVENT_BUS_PRODUCER = 'edx_event_bus_redis.create_producer' | ||
EVENT_BUS_REDIS_CONNECTION_URL = 'redis://:[email protected]:6379/' | ||
EVENT_BUS_TOPIC_PREFIX = 'dev' | ||
EVENT_BUS_CONSUMER = 'edx_event_bus_redis.RedisEventConsumer' | ||
EVENT_BUS_XBLOCK_LIFECYCLE_TOPIC = 'course-authoring-xblock-lifecycle' | ||
EVENT_BUS_ENROLLMENT_LIFECYCLE_TOPIC = 'course-authoring-enrollment-lifecycle' | ||
|
||
################# New settings must go ABOVE this line ################# | ||
######################################################################## | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,10 @@ | |
|
||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
from openedx_events.event_bus import get_producer | ||
|
||
from common.djangoapps.course_modes import api as modes_api | ||
from common.djangoapps.student.models import CourseEnrollment | ||
from common.djangoapps.student.signals import ENROLLMENT_TRACK_UPDATED | ||
from lms.djangoapps.certificates.config import SEND_CERTIFICATE_CREATED_SIGNAL | ||
from lms.djangoapps.certificates.generation_handler import ( | ||
CertificateGenerationNotAllowed, | ||
generate_allowlist_certificate_task, | ||
|
@@ -32,7 +30,6 @@ | |
COURSE_GRADE_NOW_PASSED, | ||
LEARNER_NOW_VERIFIED | ||
) | ||
from openedx_events.learning.signals import CERTIFICATE_CREATED | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
@@ -159,18 +156,3 @@ def _listen_for_enrollment_mode_change(sender, user, course_key, mode, **kwargs) | |
course_key, | ||
) | ||
return False | ||
|
||
|
||
@receiver(CERTIFICATE_CREATED) | ||
def listen_for_certificate_created_event(sender, signal, **kwargs): | ||
""" | ||
Publish `CERTIFICATE_CREATED` events to the event bus. | ||
""" | ||
if SEND_CERTIFICATE_CREATED_SIGNAL.is_enabled(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe you could share the private PR for edx-internal settings so we can cross-reference that the old settings are being replaced by the new, and that they match values (enabled vs disabled)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Share it where? I don't think it makes sense to link it on a public PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't want to add private links here, maybe we just add more details to the deployment plan document? |
||
get_producer().send( | ||
signal=CERTIFICATE_CREATED, | ||
topic='learning-certificate-lifecycle', | ||
event_key_field='certificate.course.course_key', | ||
event_data={'certificate': kwargs['certificate']}, | ||
event_metadata=kwargs['metadata'] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.