本文整理汇总了C++中Agent::callMethod方法的典型用法代码示例。如果您正苦于以下问题:C++ Agent::callMethod方法的具体用法?C++ Agent::callMethod怎么用?C++ Agent::callMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::callMethod方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
ConsoleEvent
QmfObject::method_call(std::string method,
qpid::types::Variant::Map in_args)
{
Agent a = _qmf_data.getAgent();
return a.callMethod(method, in_args, _qmf_data.getAddr());
}
示例2: main
int main(int argc, char **argv)
{
qpid::types::Variant::Map options;
qpid::types::Variant::Map callOptions;
qpid::messaging::Connection connection;
string sessionOptions;
ConsoleEvent event;
Agent agent;
mh_log_init("sysconfig-console", LOG_TRACE, TRUE);
mh_add_option('U', required_argument, "uri", "URI of configuration", &options, NULL);
mh_add_option('d', no_argument, "daemon", "run as a daemon", NULL, mh_should_daemonize);
qpid::types::Variant::Map amqp_options = mh_parse_options("sysconfig-console", argc, argv, options);
callOptions["uri"] = options["uri"];
mh_log_init("sysconfig-console", mh_log_level, mh_log_level > LOG_INFO);
connection = mh_connect(options, amqp_options, TRUE);
connection.open();
ConsoleSession session(connection, sessionOptions);
// Only filter connecting agents under matahariproject.org vendor and Config product
session.setAgentFilter("[and, [eq, _vendor, [quote, 'matahariproject.org']], [eq, _product, [quote, 'Sysconfig']]]");
session.open();
while(session.getAgentCount() == 0) {
g_usleep(1000);
}
while (true) {
if(session.nextEvent(event)) {
switch(event.getType()) {
case CONSOLE_AGENT_ADD:
{
agent = event.getAgent();
DataAddr agent_event_addr("Sysconfig", agent.getName(), 0);
ConsoleEvent result(agent.callMethod("run_uri",
callOptions,
agent_event_addr));
}
break;
default:
break;
}
}
}
return 0;
}