"""Event handling logic.""" from kafka_utils.consumer.message.product import ProductEventMessage from kafka_utils.exceptions import IneligibleEventException from src import config from src.logic.notification import send_complete_escal_notification def processing_logic(message, json_deserializer): """Process msk event.""" event = ProductEventMessage( message.value, message.topic, value_deserializer=json_deserializer ) operation_context = event.operation_context if event.product_id in config.EXPLICIT_SKIP_PRODUCT_IDS: raise IneligibleEventException('skip operation: product in explicit skip list') if operation_context not in ('approve', 'reject'): raise IneligibleEventException(f'skip operation: {operation_context}') send_complete_escal_notification( queue_id=event.review_queue_id, product_id=event.product_id, operation_context=operation_context )