From 3e6c0b38a36af5276dd4ce7a1bd0d0dfc5a3d03f Mon Sep 17 00:00:00 2001
From: zhangjl <zhangjl@awcloud.com>
Date: Thu, 3 Apr 2014 12:44:23 +0800
Subject: [PATCH] Message was send to wrong node with use zmq as rpc_backend

zmq: Send message to correct endpoint for directed messages

If set the zmq driver needs to use the topic.server
attribute to ensure that messages directed to a
specific endpoint are sent to the correct server rather
than being randomly sent to endpoints advertising the
required topic.

Change-Id: If63235640e0b8e6ec8690a4edaefa1b303705ac6
Closes-bug: #1301723
---
 oslo/messaging/_drivers/impl_zmq.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/oslo/messaging/_drivers/impl_zmq.py b/oslo/messaging/_drivers/impl_zmq.py
index 7505e9c25..4c94e460c 100644
--- a/oslo/messaging/_drivers/impl_zmq.py
+++ b/oslo/messaging/_drivers/impl_zmq.py
@@ -939,6 +939,8 @@ class ZmqDriver(base.BaseDriver):
             # NOTE(ewindisch): fanout~ is used because it avoid splitting on
             # and acts as a non-subtle hint to the matchmaker and ZmqProxy.
             topic = 'fanout~' + topic
+        elif target.server:
+            topic = '%s.%s' % (topic, target.server)
 
         reply = _multi_send(method, context, topic, message,
                             envelope=envelope,