From a76715ba21de6c2468b376234fb3b9b76ccf9981 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Mon, 21 Oct 2024 11:58:32 -0400 Subject: [PATCH] docs: Update openedx-events.rst --- docs/concepts/openedx-events.rst | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/concepts/openedx-events.rst b/docs/concepts/openedx-events.rst index a4a7146e..d48add7c 100644 --- a/docs/concepts/openedx-events.rst +++ b/docs/concepts/openedx-events.rst @@ -1,29 +1,20 @@ Open edX Events =============== -In the context of Open edX, events provide a mechanism for extending the platform by enabling developers to listen to specific Django signals emitted by various services and respond accordingly. This allows for customized reactions to key actions or changes within the platform without modifying the Open edX platform codebase. +Overview +-------- + +In the context of Open edX, events provide a mechanism for extending the platform by enabling developers to listen to Open edX-specific Django signals emitted by various services and respond accordingly. This allows for customized reactions to key actions or changes within the platform without modifying the Open edX platform codebase. What are Open edX Events? ------------------------- -An Open edX Event is an Open edX-specific Django signal emitted by a service when a specific action or event occurs. These signals notify other services or components of the platform that an event has taken place, allowing them to respond accordingly. Events are defined using the ``OpenEdxPublicSignal`` class, which provides a structured way to define the data and metadata associated with the event and other relevant information. - -Why are Open edX Events important? ----------------------------------- - -Open edX Events are a key component of the Hooks Extension Framework, which allows developers to extend the platform's functionality in a stable and maintainable way. By triggering events for specific actions or changes within the platform, developers can create event handlers that respond to these events and perform additional actions or processing as needed. This enables many use cases, from integrating with external systems to implementing custom business logic. - -How are Open edX Events used? ------------------------------ - -Developers can create handlers for Open edX Events by implementing Django signal handlers that respond to these events emitted by the platform. These signal handlers can be registered using Django's signal mechanism, allowing them to listen for events and execute custom logic in response. - -For more information on using Open edX Events, refer to the `Using Open edX Events`_ how-to guide. +An Open edX Event is an Open edX-specific Django signal emitted by a service when a specific action or event occurs. These signals notify other services or components of the platform that an event has taken place, allowing them to respond accordingly. How do Open edX Events work? ---------------------------- -Open edX Events are implemented using Django signals, which provide a way to send and receive notifications within a Django application. Due to this design, Open edX Events closely follow the Django signal pattern, allowing developers to leverage their existing knowledge of the framework. +Events are defined using the ``OpenEdxPublicSignal`` class, which provides a structured way to define the data and metadata associated with the event and other relevant information. This class is built on top of the ``Signal`` Django class, which provides a way to send and receive notifications when an action takes place within the Open edX ecosystem. Due to this design, Open edX Events follow the Django signal pattern, allowing developers to leverage their existing knowledge of the framework. The lifecycle of an Open edX Event can be summarized as follows: @@ -41,6 +32,13 @@ Here is an example of how that might look like with an existing event: The `Django Signals Documentation`_ provides a more detailed explanation of how Django signals work. +How are Open edX Events used? +----------------------------- + +Developers can create handlers for Open edX Events by implementing Django signal handlers that respond to these events emitted by the Open edX platform. These signal handlers can be registered using Django's signal mechanism, allowing them to listen for events and execute custom logic in response. + +For more information on using Open edX Events, refer to the `Using Open edX Events`_ how-to guide. + .. _Using Open edX Events: ../how-tos/using-events.html .. _Django Signals Documentation: https://docs.djangoproject.com/en/4.2/topics/signals/ .. _triggering the COURSE_ENROLLMENT_CREATED event: https://github.com/openedx/edx-platform/blob/master/common/djangoapps/student/models/course_enrollment.py#L777-L795