Don't include msg_id or reply_q in casts
On the server side, we only send replies if the request included a _msg_id key. Also, the _reply_q key is only used when we wish to send a reply. So, in order to retain the exact same on-the-wire behaviour and ensure servers aren't sending replies where none is needed, only include these keys if we're doing a call (i.e. wait_for_reply=True). Change-Id: Iac329493252be7d94b1ebe24f00e4d3f5c61d269
This commit is contained in:
parent
361092a488
commit
f7cf85333c
@ -316,14 +316,15 @@ class AMQPDriverBase(base.BaseDriver):
|
||||
context = Context(ctxt)
|
||||
msg = message
|
||||
|
||||
msg_id = uuid.uuid4().hex
|
||||
msg.update({'_msg_id': msg_id})
|
||||
LOG.debug('MSG_ID is %s' % (msg_id))
|
||||
if wait_for_reply:
|
||||
msg_id = uuid.uuid4().hex
|
||||
msg.update({'_msg_id': msg_id})
|
||||
LOG.debug('MSG_ID is %s' % (msg_id))
|
||||
msg.update({'_reply_q': self._get_reply_q()})
|
||||
|
||||
rpc_amqp._add_unique_id(msg)
|
||||
rpc_amqp.pack_context(msg, context)
|
||||
|
||||
msg.update({'_reply_q': self._get_reply_q()})
|
||||
|
||||
if envelope:
|
||||
msg = rpc_common.serialize_msg(msg)
|
||||
|
||||
|
@ -97,7 +97,7 @@ class TestRabbitTransportURL(test_utils.BaseTestCase):
|
||||
|
||||
target = messaging.Target(topic='testtopic')
|
||||
|
||||
driver.send(target, {}, {})
|
||||
driver.listen(target)
|
||||
|
||||
self.assertEquals(passed_params[0], self.expected)
|
||||
|
||||
@ -368,10 +368,9 @@ class TestRequestWireFormat(test_utils.BaseTestCase):
|
||||
received = msgs[0]
|
||||
received['oslo.message'] = jsonutils.loads(received['oslo.message'])
|
||||
|
||||
# FIXME(markmc): add _msg_id and _reply_q check
|
||||
expected_msg = {
|
||||
'_msg_id': self.uuids[0].hex,
|
||||
'_unique_id': self.uuids[1].hex,
|
||||
'_reply_q': 'reply_' + self.uuids[2].hex,
|
||||
'_unique_id': self.uuids[0].hex,
|
||||
}
|
||||
expected_msg.update(self.expected)
|
||||
expected_msg.update(self.expected_ctxt)
|
||||
|
Loading…
Reference in New Issue
Block a user