hrift -gen cpp storm.thrift
service Nimbus
{
//TOPOLOGY上传接口
void submitTopology(1: string name, 2: string uploadedJarLocation, 3: string jsonConf, 4: StormTopology topology);
void submitTopologyWithOpts(1: string name, 2: string uploadedJarLocation, 3: string jsonConf, 4: StormTopology topology, 5: SubmitOptions options);
void killTopology(1: string name);
void killTopologyWithOpts(1: string name, 2: KillOptions options) throws (1: NotAliveException e);
void activate(1: string name) ;
void deactivate(1: string name);
void rebalance(1: string name, 2: RebalanceOptions options);
//TOPOLOGY JAR包上传接口
string beginFileUpload();
void uploadChunk(1: string location, 2: binary chunk);
void finishFileUpload(1: string location);
string beginFileDownload(1: string file);
binary downloadChunk(1: string id);
//获取NIMBUS的配置信息
string getNimbusConf();
//获取STORM集群运行信息
ClusterSummary getClusterInfo();
//获取TOPOLOGY的运行状态信息
TopologyInfo getTopologyInfo(1: string id);
//获取TOPOLOGY对象信息
string getTopologyConf(1: string id);
StormTopology getTopology(1: string id);
StormTopology getUserTopology(1: string id);
}
#define HAVE_NETDB_H //使用网络模块的宏必须打开
#include "Nimbus.h"
#include "storm_types.h"
#include <string>
#include <iostream>
#include <set>
#include <transport/TSocket.h>
#include <transport/TBufferTransports.h>
#include <protocol/TBinaryProtocol.h>
int test_storm_thrift()
{
boost::shared_ptr<TSocket> tsocket(new TSocket("storm-nimbus-server", 6627));
boost::shared_ptr<TTransport> ttransport(new TFramedTransport(tsocket, 1024 * 512)); //此处必须使用TFramedTransport
boost::shared_ptr<TProtocol> tprotocol(new TBinaryProtocol(ttransport));
try{
//创建一个nimbus客户端对象
NimbusClient client(tprotocol);
//打开通道
ttransport->open();
ClusterSummary summ;
std::string conf;
//对STORM的RPC调用,直接获取信息,同步进行的。
client.getNimbusConf(conf);
client.getClusterInfo(summ);
//关闭通道
ttransport->close();
}catch(TException &tx){
printf("InvalidOperation: %s
", tx.what());
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有