15 #ifndef __HCE_HANDLER_INCLUDED__
16 #define __HCE_HANDLER_INCLUDED__
26 #include <Poco/Timestamp.h>
27 #include <Poco/DateTimeFormatter.h>
28 #include <Poco/Logger.h>
29 #include <Poco/AutoPtr.h>
30 #include <Poco/Configurable.h>
31 #include <Poco/Util/IniFileConfiguration.h>
32 #include <Poco/String.h>
33 #include <Poco/Path.h>
34 #include <Poco/File.h>
46 int64_t startedAt,
unsigned char logPriority,
const std::string& iniFile=
"") :
103 return (static_cast<Handler*>(that))->process();
252 std::string timeMark = Poco::DateTimeFormatter::format(Poco::Timestamp(static_cast<Poco::Timestamp::TimeVal>(s_clock() * 1000)),
_logTimeFormat);
255 std::string message =
log.str();
258 log.str(std::string());
264 log << std::setfill(
'0') << std::setw(8) << ((
unsigned int)(s_clock() -
getStartedAt())) <<
" ";
270 std::cout <<
log.str();
275 log.str(std::string());
281 if (!iniFile.empty()){
290 Poco::AutoPtr<Poco::Util::IniFileConfiguration> pConf(
new Poco::Util::IniFileConfiguration(iniFile));
298 catch(Poco::SyntaxException& e)
301 logger.
log(
NODE_LOG_MODE_ERROR) <<
"nodeInit() - data node options ini file processing error: '" << e.displayText() <<
"'" <<
flush;
304 catch(Poco::Exception& e)
343 std::string messageId((
const char*)msg.
pop_front().c_str());
345 std::string messageCommand((
const char*)msg.
pop_front().c_str());
347 std::string messageParams((
const char*)msg.
pop_front().c_str());
349 std::string messageSrcIdentity((
const char*)msg.
pop_front().c_str());
351 logger.
log(
NODE_LOG_MODE_DEBUG) <<
"RECEIVED admin message from inproc_admin id [" << messageId <<
"], body [" << messageCommand <<
"], params ["
352 << messageParams <<
"], source identity [" << messageSrcIdentity <<
"]" <<
flush;
365 std::istringstream(messageParams) >> logp;
375 std::istringstream(messageParams) >> pollTimeout;
386 std::istringstream(messageParams) >> propertyInterval;
397 std::istringstream(messageParams) >> dumpInterval;
411 msg.
append(messageId.c_str());
413 msg.
append(response.c_str());
415 msg.
append(messageSrcIdentity.c_str());
419 std::string
ret(
"DEFAULT stub for command processor!");
469 unsigned int counter = 0;
472 sock_p->
bind(connectionString.c_str());
503 bool connected =
false;
508 if(byeMessage !=
""){
525 sock_p->
setsockopt(ZMQ_IDENTITY, identity.c_str(), identity.size());
529 unsigned int counter = 0;
532 sock_p->
connect(connectionString.c_str());
552 sock_p->
setsockopt(ZMQ_LINGER, &linger,
sizeof(linger));
556 if(readyMessage !=
""){
558 s_send(*sock_p, readyMessage);
570 s_send(*sock_p, byeMessage);
575 std::stringstream result;
584 std::string
ret(
"DEFAULT stub for property informaion!");
593 std::string message = propertyMessage.
build();
594 if (!propertyMessage.
isError()){
597 if (
getName() ==
"DataServerProxy"){
610 Poco::File dirPath(name);
612 if (!dirPath.exists()){
613 dirPath.createDirectories();
615 }
catch(Poco::Exception& e){
623 std::ostringstream ostr;
631 std::ostringstream ostr;
661 virtual void*
process(
void) = 0;