summaryrefslogtreecommitdiff
path: root/cpp/examples/qmf-agent/example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/examples/qmf-agent/example.cpp')
-rw-r--r--cpp/examples/qmf-agent/example.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/cpp/examples/qmf-agent/example.cpp b/cpp/examples/qmf-agent/example.cpp
index 5ab9c10c91..18f1bf6a90 100644
--- a/cpp/examples/qmf-agent/example.cpp
+++ b/cpp/examples/qmf-agent/example.cpp
@@ -24,6 +24,7 @@
#include <qpid/agent/ManagementAgent.h>
#include <qpid/sys/Mutex.h>
#include <qpid/sys/Time.h>
+#include "qpid/types/Variant.h"
#include "qmf/org/apache/qpid/agent/example/Parent.h"
#include "qmf/org/apache/qpid/agent/example/Child.h"
#include "qmf/org/apache/qpid/agent/example/ArgsParentCreate_child.h"
@@ -44,6 +45,7 @@ using qpid::management::ManagementObject;
using qpid::management::Manageable;
using qpid::management::Args;
using qpid::sys::Mutex;
+using qpid::types::Variant;
namespace _qmf = qmf::org::apache::qpid::agent::example;
class ChildClass;
@@ -96,8 +98,22 @@ CoreClass::CoreClass(ManagementAgent* _agent, string _name) : name(_name), agent
static uint64_t persistId = 0x111222333444555LL;
mgmtObject = new _qmf::Parent(agent, this, name);
- agent->addObject(mgmtObject, persistId++);
+ agent->addObject(mgmtObject);
mgmtObject->set_state("IDLE");
+
+ Variant::Map args;
+ Variant::Map subMap;
+ args["first"] = "String data";
+ args["second"] = 34;
+ subMap["string-data"] = "Text";
+ subMap["numeric-data"] = 10000;
+ args["map-data"] = subMap;
+ mgmtObject->set_args(args);
+
+ Variant::List list;
+ list.push_back(20000);
+ list.push_back("string-item");
+ mgmtObject->set_list(list);
}
void CoreClass::doLoop()
@@ -178,6 +194,9 @@ int main_int(int argc, char** argv)
// Register the Qmf_example schema with the agent
_qmf::Package packageInit(agent);
+ // Name the agent.
+ agent->setName("apache.org", "qmf-example");
+
// Start the agent. It will attempt to make a connection to the
// management broker
agent->init(settings, 5, false, ".magentdata");