Skip to content

Commit

Permalink
refactor: only listen to event bus
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 25, 2023
1 parent 39c2a5e commit bd2b60b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
14 changes: 0 additions & 14 deletions event_routing_backends/config.py

This file was deleted.

22 changes: 3 additions & 19 deletions event_routing_backends/signals.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
import json
import logging

from django.conf import settings
from django.dispatch import receiver
from openedx_events.analytics.signals import TRACKING_EVENT_EMITTED
from openedx_events.event_bus import get_producer

from event_routing_backends.config import SEND_TRACKING_EVENT_EMITTED_SIGNAL
from openedx_events.analytics.signals import TRACKING_EVENT_EMITTED_TO_BUS

logger = logging.getLogger(__name__)

TRANSFORMED_EVENT_KEY_NAME = "transformed_events"

@receiver(TRACKING_EVENT_EMITTED)
@receiver(TRACKING_EVENT_EMITTED_TO_BUS)
def listen_for_tracking_event_emitted_event(sender, signal, **kwargs):
"""
Publish `TRACKING_EVENT_EMITTED` events to the event bus.
"""

if SEND_TRACKING_EVENT_EMITTED_SIGNAL.is_enabled():
logger.info("Sending events to event bus in batch")
get_producer().send(
signal=TRACKING_EVENT_EMITTED,
topic='analytics',
event_key_field='tracking_log.name',
event_data={'tracking_log': kwargs['tracking_log']},
event_metadata=kwargs['metadata']
)
print("\nSay hi from event bus\n")

0 comments on commit bd2b60b

Please sign in to comment.