diff --git a/eventtracking/backends/event_bus.py b/eventtracking/backends/event_bus.py new file mode 100644 index 00000000..00527cf3 --- /dev/null +++ b/eventtracking/backends/event_bus.py @@ -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 + )