void RecvDataSubsystem::initialize(Poco::Util::Application & self) { // TODO 初始化rtdbms对象 std::string rtdbms_ip = self.config().getString("RedisDB.Base.IPAddr", "127.0.0.1"); int rtdbms_port = self.config().getInt("RedisDB.Base.Port", 6379); _rtdbms = new CRtDbMs(rtdbms_ip,rtdbms_port); }
void ClearHistory::initialize(Poco::Util::Application & self) { // TODO subscribe the data process from the rdbms //self.config().getString(""); //redis连接设置 _rtdbms_redis_ip = self.config().getString("RedisDB.Base.IPAddr","127.0.0.1"); _rtdbms_redis_port = self.config().getInt("RedisDB.Base.Port", 6379); _rdbmsClearHis = new CRtDbMs(_rtdbms_redis_ip, _rtdbms_redis_port); ClearQueue.clear(); }
void PluginManager::initialize(Poco::Util::Application& app) { LOG_DEBUG("Initializing PluginManager"); this->loadStaticPlugins(); std::string loading_path = app.config().getString("application.dir", "."); this->loadDynamicPlugins( loading_path ); }
void MQWebSubsystem::initialize(Poco::Util::Application& app) { Poco::Logger& logger = Poco::Logger::get("mq.web"); logger.trace("Initialize MQWebSubsystem"); _dictionaryCache = new DictionaryCache(app.config().getString("mq.web.db", "mqweb.db")); _qmgrPoolCache = new QueueManagerPoolCache(); _messageConsumerThreadPool = new Poco::ThreadPool(); _messageConsumerTaskManager = new MessageConsumerTaskManager(*_messageConsumerThreadPool); }
bool PluginLauncher::launch( Poco::Util::Application& app ) { bool launched(false); if(_libName.length() > 0) { try { _sharedLib.unload(); Poco::Util::LayeredConfiguration& appConfig(app.config()); SLAString appDir(appConfig.getString("application.dir")); SLAString libPath(appDir); libPath += _libName; libPath += sl::getSharedLibSuffix(); _sharedLib.load(libPath); nlFunc_launchLayer* launchLayerFunc = queryLaunchLayerFunction(); nlFunc_launch* launchFunc = queryLaunchFunction(); if(launchFunc /*&& !launchLayerFunc*/) { launchFunc(); launched = true; } else { if(launchLayerFunc) { int returnCode(sl::CocosAppDelegate::launch(launchLayerFunc)); launched = (returnCode == 0); } else { SL_PROCESS_APP()->log( ELogType_Error, "failed to queryLaunchFunction lib: %s", _libName.c_str()); SL_PROCESS_APP()->log( ELogType_Error, "failed to queryLaunchLayerFunction lib: %s", _libName.c_str()); } } _sharedLib.unload(); } catch ( ... ) { app.logger().error("failed to launch lib: %s", _libName.c_str()); } } return launched; }
void subsystem::initialize(Poco::Util::Application& app) { webcpp::conf serverConf(app.config()); Poco::Net::HTTPServerParams* pars = new Poco::Net::HTTPServerParams; pars->setMaxQueued(serverConf.getInt("maxQueued", 1024)); pars->setMaxThreads(serverConf.getInt("maxThreads", 2048)); pars->setSoftwareVersion(serverConf.getString("softwareVersion", "webcppd/1.0.0")); pars->setKeepAlive(serverConf.getBool("keepAlive", true)); pars->setMaxKeepAliveRequests(serverConf.getInt("maxKeepAliveRequests", 0)); pars->setKeepAliveTimeout(Poco::Timespan(serverConf.getInt("keepAliveTimeout", 60), 0)); pars->setTimeout(Poco::Timespan(serverConf.getInt("timeout", 60), 0)); Poco::ThreadPool &pool = Poco::ThreadPool::defaultPool(); pool.addCapacity(serverConf.getInt("maxThreads", 2048)); Poco::Net::ServerSocket serverSocket; Poco::Net::IPAddress ipAddr(serverConf.getString("ip", "127.0.0.1")); Poco::Net::SocketAddress socketAddr(ipAddr, serverConf.getUInt("port", 8888)); serverSocket.bind(socketAddr, false); serverSocket.listen(serverConf.getInt("maxQueued", 1024)); serverSocket.acceptConnection(); this->server = new Poco::Net::HTTPServer(new webcpp::factory(), pool, serverSocket, pars); this->server->start(); }
void DatabaseSubsystem::initialize(Poco::Util::Application& app) { string dbFilename = app.config().getString("blissart.databaseFile", "openBliSSART.db"); connect(dbFilename); }