summaryrefslogtreecommitdiff
path: root/cpp/src/qmf/Agent.cpp
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2011-02-04 08:22:30 +0000
committerTed Ross <tross@apache.org>2011-02-04 08:22:30 +0000
commite46939c93ba0682d74f025eeec7bdb88229b4277 (patch)
treeeb55184ad87bc9c31168bf955256959541fc117b /cpp/src/qmf/Agent.cpp
parente7f02a8b8b25d9fcce6525ccc5b794f8438995f0 (diff)
downloadqpid-python-e46939c93ba0682d74f025eeec7bdb88229b4277.tar.gz
Added missing even handling in the console.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1067111 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qmf/Agent.cpp')
-rw-r--r--cpp/src/qmf/Agent.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/cpp/src/qmf/Agent.cpp b/cpp/src/qmf/Agent.cpp
index 8783cfa832..176cadf0c1 100644
--- a/cpp/src/qmf/Agent.cpp
+++ b/cpp/src/qmf/Agent.cpp
@@ -377,9 +377,43 @@ void AgentImpl::handleMethodResponse(const Variant::Map& response, const Message
}
-void AgentImpl::handleDataIndication(const Variant::List&, const Message&)
+void AgentImpl::handleDataIndication(const Variant::List& list, const Message& msg)
{
- // TODO
+ Variant::Map::const_iterator aIter;
+ const Variant::Map& props(msg.getProperties());
+ boost::shared_ptr<SyncContext> context;
+
+ aIter = props.find("qmf.content");
+ if (aIter == props.end())
+ return;
+
+ string content_type(aIter->second.asString());
+ if (content_type != "_event")
+ return;
+
+ for (Variant::List::const_iterator lIter = list.begin(); lIter != list.end(); lIter++) {
+ const Variant::Map& eventMap(lIter->asMap());
+ Data data(new DataImpl(eventMap, this));
+ int severity(SEV_NOTICE);
+ uint64_t timestamp(0);
+
+ aIter = eventMap.find("_severity");
+ if (aIter != eventMap.end())
+ severity = int(aIter->second.asInt8());
+
+ aIter = eventMap.find("_timestamp");
+ if (aIter != eventMap.end())
+ timestamp = aIter->second.asUint64();
+
+ auto_ptr<ConsoleEventImpl> eventImpl(new ConsoleEventImpl(CONSOLE_EVENT));
+ eventImpl->setAgent(this);
+ eventImpl->addData(data);
+ eventImpl->setSeverity(severity);
+ eventImpl->setTimestamp(timestamp);
+ if (data.hasSchema())
+ learnSchemaId(data.getSchemaId());
+ session.enqueueEvent(eventImpl.release());
+ }
}