From 045b944838ec6ae2fbae781d467839007b27904b Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Mon, 4 Nov 2013 20:38:04 +0000 Subject: QPID-5291: hook in specific connection properties to management schema git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1538753 13f79535-47bb-0310-9956-ffa450edef68 --- .../cpp/src/qpid/broker/amqp/ManagedConnection.cpp | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src') diff --git a/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp b/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp index d1595b47cc..de46165e1a 100644 --- a/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp +++ b/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp @@ -31,7 +31,20 @@ namespace _qmf = qmf::org::apache::qpid::broker; namespace qpid { namespace broker { namespace amqp { - +namespace { +const std::string CLIENT_PROCESS_NAME("qpid.client_process"); +const std::string CLIENT_PID("qpid.client_pid"); +const std::string CLIENT_PPID("qpid.client_ppid"); +template T getProperty(const std::string& key, const qpid::types::Variant::Map& props, T defaultValue) +{ + qpid::types::Variant::Map::const_iterator i = props.find(key); + if (i != props.end()) { + return i->second; + } else { + return defaultValue; + } +} +} ManagedConnection::ManagedConnection(Broker& broker, const std::string i) : id(i), agent(0) { //management integration: @@ -89,6 +102,18 @@ void ManagedConnection::setPeerProperties(std::map& peerProperties = p; if (connection) { connection->set_remoteProperties(peerProperties); + + std::string procName = getProperty(CLIENT_PROCESS_NAME, peerProperties, std::string()); + uint32_t pid = getProperty(CLIENT_PID, peerProperties, 0); + uint32_t ppid = getProperty(CLIENT_PPID, peerProperties, 0); + + if (!procName.empty()) + connection->set_remoteProcessName(procName); + if (pid != 0) + connection->set_remotePid(pid); + if (ppid != 0) + connection->set_remoteParentPid(ppid); + } } -- cgit v1.2.1