From 9c20e94dd83c0f926c3dc36c17a6a2744b9779f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 13 Jul 2018 14:09:13 +0200 Subject: [PATCH] Implement generating single messages from a queue --- lib/tfw/networking/message_sender.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/tfw/networking/message_sender.py b/lib/tfw/networking/message_sender.py index 58856b1..2b946d7 100644 --- a/lib/tfw/networking/message_sender.py +++ b/lib/tfw/networking/message_sender.py @@ -44,3 +44,11 @@ class MessageSender: 'key': self.queue_key, 'data': data }) + + @staticmethod + def generate_messages_from_queue(queue_messsge): + for message in queue_messsge['data']['messages']: + yield { + 'key': 'message', + 'data': message + }