-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Event tracker backend that emits events to the event-bus.""" | ||
from openedx_events.analytics.signals import TRACKING_EVENT_EMITTED | ||
from openedx_events.analytics.data import TrackingLogData | ||
|
||
class EventBusRoutingBackend: | ||
""" | ||
Event tracker backend that emits an Open edX public signal. | ||
""" | ||
|
||
def __init__(self, **kwargs): | ||
""" | ||
Event tracker backend that emits an Open edX public signal. | ||
""" | ||
|
||
def send(self, event): | ||
"""Emit the Open edX public signal""" | ||
tracking_data = TrackingLogData( | ||
name = event.get('name'), | ||
timestamp = event.get('timestamp').isoformat(), | ||
data = event.get('data'), | ||
context = event.get('context') | ||
) | ||
|
||
TRACKING_EVENT_EMITTED.send_event( | ||
tracking_log=tracking_data | ||
) |