54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
|
|
#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;
|
|||
|
|
|
|||
|
|
MIX_CC_TEST_DEBUG_MODE
|
|||
|
|
|
|||
|
|
eqpalg::eqpalg() { logger_ = std::make_unique<LOG>("eqpalg"); }
|
|||
|
|
|
|||
|
|
eqpalg::~eqpalg() {
|
|||
|
|
logger_->Info() << "eqpalg::~eqpalg()"
|
|||
|
|
<< "Destruct" << endl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
int eqpalg::start() {
|
|||
|
|
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_PLATFORM_SERVER_INSTALL(eqpalg, APPVERSION);
|