def deliver_text_message_to_receiver(message: TextMessage): # If the message is too large, don't deliver the message directly. # For now, drop the message, in future it can be sent as a link to a storage bucket. if (message.get_text_message_size() > 100): raise Exception('Message too large to send {} > 100 bytes', message.get_message_size()) print('Message "{}" delivered successfully to {}'.format( message.get_text_message_content(), message.get_receiver())) pass
def deliver_text_message_to_receiver(message: TextMessage): # Logic to actually send the message to the user. It may happen through some queueing mechanism. # Out of syllabus for this exercise :') # If the message is too large, don't deliver the message directly. # For now, drop the message, in future it can be sent as a link to a storage bucket. if (message.get_text_message_size() > 100): raise Exception('Message too large to send {} > 100 bytes', message.get_message_size()) print('Message "{}" delivered successfully to {}'.format( message.get_text_message_content(), message.get_receiver())) pass