eis/eqpalg/eqpalg.cpp

58 lines
1.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <eqpalg/define/public.h>
#include <eqpalg/eqpalg.h>
#include <glob/GlobDefine.h>
#include <utility/IniProperty.h>
#include <memory>
#include <string>
#include "mix_cc/debug/pre_define.h"
using namespace baosight;
ProcessType glob_process_type;
// CreateModels glob_create_models;
MIX_CC_TEST_DEBUG_MODE
eqpalg::eqpalg() { logger_ = std::make_unique<LOG>("eqpalg"); }
eqpalg::~eqpalg() {
logger_->Info() << "eqpalg::~eqpalg()"
<< "Destruct" << endl;
}
int eqpalg::start() {
string ss0 = "rm -rf /users/dsc/shm/MapRuleStat_boost.mmap";
system(ss0.c_str());
logger_->Info() << "start eqpalg." << endl;
// 启动ConnectionMag这个一定不要去除否则内部很多邹师傅写的库都无法正常工作
con_mag_ = std::make_shared<ConnectionMag>();
con_mag_->dbLogin();
try {
auto module_name = name();
// 根据模块名称,设置全局变量线程类型
if (module_name == "eqpalg-mon") {
glob_process_type = ProcessType::kMon;
} else if (module_name == "eqpalg-cron") {
glob_process_type = ProcessType::kCron;
} else if (module_name == "eqpalg-task") {
glob_process_type = ProcessType::kTask;
} else {
glob_process_type = ProcessType::kNull;
}
eqpalg_server = new EqpAlgICEI();
this->add(string("baosight/") + name(), eqpalg_server);
} catch (::Ice::LocalException& e) {
logger_->Error() << "Can not add baosight/eqpalg, error: " << e.what()
<< ",location:" << BOOST_CURRENT_LOCATION << endl;
return (-1);
} catch (std::exception& e) {
logger_->Error() << e.what() << ",location:" << BOOST_CURRENT_LOCATION
<< endl;
}
return 0;
}
// PACE_SERVER_INSTALL(eqpalg) //应用程序主入口,传入参数为定义的类名
PACE_PLATFORM_SERVER_INSTALL(eqpalg, APPVERSION);