Skip to content

Commit

Permalink
feat: add event bus backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Jun 5, 2023
1 parent c6b86c3 commit 2fc6de0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions eventtracking/backends/event_bus.py
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'),
data = event.get('data'),
context = event.get('context')
)

TRACKING_EVENT_EMITTED.send_event(
tracking_log=tracking_data
)

0 comments on commit 2fc6de0

Please sign in to comment.