Browse Source

Py3: Fix encoding of message in RetryEngine

Change-Id: I07b96fb8ed486d620f9911827a1f3182fe0e9b84
tags/1.15.0
Dobroslaw Zybort 9 months ago
parent
commit
c8b9b81f61
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      monasca_notification/retry_engine.py

+ 4
- 2
monasca_notification/retry_engine.py View File

@@ -17,11 +17,12 @@
17 17
 import json
18 18
 import time
19 19
 
20
+from monasca_common.kafka import consumer
21
+from monasca_common.kafka import producer
20 22
 from oslo_config import cfg
21 23
 from oslo_log import log as logging
24
+from six import PY3
22 25
 
23
-from monasca_common.kafka import consumer
24
-from monasca_common.kafka import producer
25 26
 from monasca_notification.common.utils import construct_notification_object
26 27
 from monasca_notification.common.utils import get_db_repo
27 28
 from monasca_notification.common.utils import get_statsd_client
@@ -51,6 +52,7 @@ class RetryEngine(object):
51 52
         for raw_notification in self._consumer:
52 53
             message = raw_notification[1].message.value
53 54
 
55
+            message = message.decode('UTF-8') if PY3 else message
54 56
             notification_data = json.loads(message)
55 57
 
56 58
             notification = construct_notification_object(self._db_repo, notification_data)

Loading…
Cancel
Save