aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/common
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-04-13 18:40:38 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-04-19 09:02:39 +0100
commit8253157792c9785df5dda1372adc6c71a65680c4 (patch)
tree07e99513acdc2b2302cef665e1fdb177e11f35d5 /yardstick/common
parent156df0ca22164a7cb7b474230851bc04f688e49f (diff)
MessagingConsumer accepts messages from multiple producers
The messaging consumer now can store a list of PID of several producers. The notification handler can compare the procedence of a message from a list of PID. JIRA: YARDSTICK-1074 Change-Id: I193f83c2b471e5bf1298ac728be52533aded0c1a Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/common')
-rw-r--r--yardstick/common/messaging/consumer.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/yardstick/common/messaging/consumer.py b/yardstick/common/messaging/consumer.py
index a0feeb300..24ec6f184 100644
--- a/yardstick/common/messaging/consumer.py
+++ b/yardstick/common/messaging/consumer.py
@@ -29,9 +29,9 @@ LOG = logging.getLogger(__name__)
class NotificationHandler(object):
"""Abstract class to define a endpoint object for a MessagingConsumer"""
- def __init__(self, id, ctx_pid, queue):
- self._id = id
- self._ctx_pid = ctx_pid
+ def __init__(self, _id, ctx_pids, queue):
+ self._id = _id
+ self._ctx_pids = ctx_pids
self._queue = queue
@@ -43,12 +43,12 @@ class MessagingConsumer(object):
the messages published by a `MessagingNotifier`.
"""
- def __init__(self, topic, pid, endpoints, fanout=True):
+ def __init__(self, topic, pids, endpoints, fanout=True):
"""Init function.
:param topic: (string) MQ exchange topic
- :param pid: (int) PID of the process implementing the MQ Notifier which
- will be in the message context
+ :param pids: (list of int) list of PIDs of the processes implementing
+ the MQ Notifier which will be in the message context
:param endpoints: (list of class) list of classes implementing the
methods (see `MessagingNotifier.send_message) used by
the Notifier
@@ -58,7 +58,7 @@ class MessagingConsumer(object):
:returns: `MessagingConsumer` class object
"""
- self._pid = pid
+ self._pids = pids
self._endpoints = endpoints
self._transport = oslo_messaging.get_rpc_transport(
cfg.CONF, url=messaging.TRANSPORT_URL)