diff options
| author | Gordon Sim <gsim@apache.org> | 2013-11-04 20:38:04 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-11-04 20:38:04 +0000 |
| commit | 045b944838ec6ae2fbae781d467839007b27904b (patch) | |
| tree | aad1df0e7b9540e5223877b831244590f9fe9d18 /qpid/cpp | |
| parent | ab08e0d29387c9254edc958ebe037e32545b25a2 (diff) | |
| download | qpid-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.cpp | 27 |
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); + } } |
