qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1538753 - /qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp
Date Mon, 04 Nov 2013 20:38:04 GMT
Author: gsim
Date: Mon Nov  4 20:38:04 2013
New Revision: 1538753

URL: http://svn.apache.org/r1538753
Log:
QPID-5291: hook in specific connection properties to management schema

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp?rev=1538753&r1=1538752&r2=1538753&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp Mon Nov  4 20:38:04 2013
@@ -31,7 +31,20 @@ namespace _qmf = qmf::org::apache::qpid:
 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 <typename T> 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::setPeerPropertie
     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);
+
     }
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message