def handle(self, cud_message_dict: {}): cud_message = CUDMessage(from_string_to_enum(cud_message_dict["message_type"]), #MessageType from_string_to_enum(cud_message_dict["message_collection"]), #MessageCollection cud_message_dict["message_body"]) if cud_message.message_collection == MessageCollection.PRODUCT: self.handle_product_cud(cud_message) if cud_message.message_collection == MessageCollection.CATEGORY: self.handle_category_cud(cud_message)
def product_insert(mapper, connection, target): changeMessagePublisher.publish_task( CUDMessage(MessageType.CREATE, MessageCollection.PRODUCT, target.serialize()).serialize(), only_for_catalog=True)
def product_update(mapper, connection, target): changeMessagePublisher.publish_task( CUDMessage(MessageType.UPDATE, MessageCollection.PRODUCT, target.serialize()).serialize(), only_for_catalog=False)
def category_delete(mapper, connection, target): changeMessagePublisher.publish_task( CUDMessage(MessageType.DELETE, MessageCollection.CATEGORY, target.serialize()).serialize(), only_for_catalog=True)