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 8, 2023
1 parent c6b86c3 commit 8e050c1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions eventtracking/backends/event_bus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""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 TRACKING_EVENT_EMITTED Open edX public signal to allow
other apps to listen for tracking events.
"""
# .. event_implemented_name: TRACKING_EVENT_EMITTED
TRACKING_EVENT_EMITTED.send_event(
tracking_log=TrackingLogData(
name=event.get('name'),
timestamp=event.get('timestamp'),
data=event.get('data'),
context=event.get('context')
)
)

0 comments on commit 8e050c1

Please sign in to comment.