diff options
author | Ted Ross <tross@apache.org> | 2011-03-07 19:13:56 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2011-03-07 19:13:56 +0000 |
commit | 92da7592b082b3fc9e847b80d6db8538fb29be29 (patch) | |
tree | 680b3ec8b6c64ced348840dcc27e1ddefbafee2d | |
parent | f1836df4057851f07b1346e7141b863158493987 (diff) | |
download | qpid-python-92da7592b082b3fc9e847b80d6db8538fb29be29.tar.gz |
QPID_3122 - Added backward-compatible map keys in QMFv2 consoles for earlier development agents.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1078895 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/qmf/ConsoleSession.cpp | 18 | ||||
-rw-r--r-- | qpid/extras/qmf/src/py/qmf/console.py | 17 |
2 files changed, 31 insertions, 4 deletions
diff --git a/qpid/cpp/src/qmf/ConsoleSession.cpp b/qpid/cpp/src/qmf/ConsoleSession.cpp index 2136a7d449..7b839930e1 100644 --- a/qpid/cpp/src/qmf/ConsoleSession.cpp +++ b/qpid/cpp/src/qmf/ConsoleSession.cpp @@ -429,7 +429,23 @@ void ConsoleSessionImpl::handleAgentUpdate(const string& agentName, const Varian iter = content.find("_values"); if (iter == content.end()) return; - Variant::Map attrs(iter->second.asMap()); + const Variant::Map& in_attrs(iter->second.asMap()); + Variant::Map attrs; + + // + // Copy the map from the message to "attrs". Translate any old-style + // keys to their new key values in the process. + // + for (iter = in_attrs.begin(); iter != in_attrs.end(); iter++) { + if (iter->first == "epoch") + attrs[protocol::AGENT_ATTR_EPOCH] = iter->second; + else if (iter->first == "timestamp") + attrs[protocol::AGENT_ATTR_TIMESTAMP] = iter->second; + else if (iter->first == "heartbeat_interval") + attrs[protocol::AGENT_ATTR_HEARTBEAT_INTERVAL] = iter->second; + else + attrs[iter->first] = iter->second; + } iter = attrs.find(protocol::AGENT_ATTR_EPOCH); if (iter != attrs.end()) diff --git a/qpid/extras/qmf/src/py/qmf/console.py b/qpid/extras/qmf/src/py/qmf/console.py index 6f4c11ae15..ecb0e1d9d0 100644 --- a/qpid/extras/qmf/src/py/qmf/console.py +++ b/qpid/extras/qmf/src/py/qmf/console.py @@ -1211,11 +1211,22 @@ class Session: try: agentName = ah["qmf.agent"] values = content["_values"] - timestamp = values["_timestamp"] - interval = values["_heartbeat_interval"] + + if '_timestamp' in values: + timestamp = values["_timestamp"] + else: + timestamp = values['timestamp'] + + if '_heartbeat_interval' in values: + interval = values['_heartbeat_interval'] + else: + interval = values['heartbeat_interval'] + epoch = 0 if '_epoch' in values: epoch = values['_epoch'] + elif 'epoch' in values: + epoch = values['epoch'] except Exception,e: return @@ -2416,7 +2427,7 @@ class Broker(Thread): if uid.__class__ == tuple and len(uid) == 2: self.saslUser = uid[1] else: - self.saslUser = None + self.saslUser = self.authUser # prevent topic queues from filling up (and causing the agents to # disconnect) by discarding the oldest queued messages when full. |