summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2013-11-04 20:38:04 +0000
committerGordon Sim <gsim@apache.org>2013-11-04 20:38:04 +0000
commit045b944838ec6ae2fbae781d467839007b27904b (patch)
treeaad1df0e7b9540e5223877b831244590f9fe9d18 /qpid/cpp
parentab08e0d29387c9254edc958ebe037e32545b25a2 (diff)
downloadqpid-python-045b944838ec6ae2fbae781d467839007b27904b.tar.gz
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
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/broker/amqp/ManagedConnection.cpp27
1 files changed, 26 insertions, 1 deletions
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 <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::setPeerProperties(std::map<std::string, types::Variant>&
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);
+
}
}