Example #1
0
/*
 Initialization method for output buffer
 */
void ZMQClient::init(void *init_data) throw(CException) {
    CDataWrapper *cfg = reinterpret_cast<CDataWrapper*>(init_data);
    ZMQC_LAPP << "initialization";
    int32_t threadNumber = cfg->hasKey(InitOption::OPT_RPC_SERVER_THREAD_NUMBER)? cfg->getInt32Value(InitOption::OPT_RPC_SERVER_THREAD_NUMBER):1;
    ZMQC_LAPP << "ObjectProcessingQueue<CDataWrapper> initialization with "<< threadNumber <<" thread";
    CObjectProcessingQueue<NetworkForwardInfo>::init(threadNumber);
    ZMQC_LAPP << "ObjectProcessingQueue<NetworkForwardInfo> initialized";
    
    ZMQC_LAPP << "ConnectionPool initialization";
    zmq_context = zmq_ctx_new();
    CHAOS_ASSERT(zmq_context)
    
    //et the thread number
    zmq_ctx_set(zmq_context, ZMQ_IO_THREADS, threadNumber);
    
    if(GlobalConfiguration::getInstance()->getRpcImplKVParam().count("zmq_timeout")) {
        CHAOS_NOT_THROW(zmq_timeout = boost::lexical_cast<int>(GlobalConfiguration::getInstance()->getRpcImplKVParam()["zmq_timeout"]););