⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgqosfactory.cpp

📁 java开源的企业总线.xmlBlaster
💻 CPP
📖 第 1 页 / 共 2 页
字号:
      string charset;      iter = attrs.find("charset");      if (iter != attrs.end()) charset = (*iter).second;      clientProperty_ = new ClientProperty(true, nameAttr, type, encoding, charset);   }      }void MsgQosFactory::characters(const string &ch) {   XmlHandlerBase::characters(ch);   if (inQueue_ || inPersistence_) queuePropertyFactory_.characters(ch);}void MsgQosFactory::endElement(const string &name) {   if (name.compare("qos") == 0) {      inQos_ = false;      return;   }   //log_.error(ME, "endElement: name=" + name + " character_=" + character_);   if (inQueue_ || inPersistence_) {      queuePropertyFactory_.endElement(name);      if(name.compare("queue") == 0) {         inQueue_ = false;         character_.erase();         QueuePropertyBase tmp = queuePropertyFactory_.getQueueProperty();         string relating = tmp.getRelating();         TopicProperty tmpProp = msgQosDataP_->getTopicProperty();         if (relating == Constants::RELATING_HISTORY) {            tmpProp.setHistoryQueueProperty(tmp);            msgQosDataP_->setTopicProperty(tmpProp);         }         else {            log_.error(ME, string("Ignoring unknown <queue relating='") + relating + "'/> configuration");         }         return;      }      if(name.compare("persistence") == 0) { // topic: RELATING_MSGUNITSTORE         inPersistence_ = false;         character_.erase();         QueuePropertyBase tmp = queuePropertyFactory_.getQueueProperty();         TopicProperty tmpProp = msgQosDataP_->getTopicProperty();         tmpProp.setMsgUnitStoreProperty(tmp);         msgQosDataP_->setTopicProperty(tmpProp);         return;      }   }   if (name.compare("state") == 0) {      inState_ = false;      character_.erase();      return;   }   if( name.compare("destination") == 0) {      inDestination_ = false;      StringTrim::trim(character_); // The address or XPath query string      if (!character_.empty()) {         destination_.getDestination()->setAbsoluteName(character_); // set address or XPath query string if it is before the forceQueuing tag         character_.erase();      }      msgQosDataP_->addDestination(destination_);      return;   }   if(name.compare("sender") == 0) {      inSender_ = false;      StringTrim::trim(character_);      msgQosDataP_->getSender()->setAbsoluteName(character_);      // if (log.trace()) log.trace(ME, "Found message sender login name = " + msgQosData.getSender());      character_.erase();      return;   }   if(name.compare("priority") == 0) {      inPriority_ = false;      msgQosDataP_->setPriority(str2Priority(character_));      character_.erase();      return;   }   if(name.compare("expiration") == 0) {      inExpiration_ = false;      character_.erase();      return;   }   if(name.compare("rcvTimestamp") == 0) {      inRcvTimestamp_ = false;      character_.erase();      return;   }   if(name.compare("forceUpdate") == 0) {      inIsVolatile_ = false;      msgQosDataP_->setForceUpdate(StringTrim::isTrueTrim(character_));      character_.erase();      return;   }   if (name.compare(MethodName::SUBSCRIBE) == 0) {      inSubscribe_ = false;      character_.erase();      return;   }   if(name.compare("persistent") == 0) {      inIsPersistent_ = false;      msgQosDataP_->setPersistent(StringTrim::isTrueTrim(character_));      character_.erase();      return;   }   if(name.compare("readonly") == 0) {      inReadonly_ = false;      msgQosDataP_->setReadonly(StringTrim::isTrueTrim(character_));      character_.erase();      return;   }   if(name.compare("redeliver") == 0) {      inRedeliver_ = false;      StringTrim::trim(character_);      msgQosDataP_->setRedeliver(atoi(character_.c_str()));      character_.erase();      return;   }   if (name.compare("node") == 0) {      msgQosDataP_->addRouteInfo(routeInfo_);      character_.erase();      return;   }   if (name.compare("route") == 0) {      inRoute_ = false;      character_.erase();      return;   }   if (name.compare("clientProperty") == 0) {      inClientProperty_ = false;      clientProperty_->setValueRaw(character_);      msgQosDataP_->addClientProperty(*clientProperty_);      delete clientProperty_;      clientProperty_ = 0;      character_.erase();   }   character_.erase(); // reset data from unknown tags}/** Configure if remaingLife is sent in Qos (redesign approach to work with all QoS attributes */void MsgQosFactory::sendRemainingLife(bool sendRemainingLife) {    sendRemainingLife_ = sendRemainingLife; }bool MsgQosFactory::sendRemainingLife() {    return sendRemainingLife_; }}}}}#ifdef _XMLBLASTER_CLASSTESTusing namespace std;using namespace org::xmlBlaster::util::qos;int main(int args, char* argv[]){    try    {       Global& glob = Global::getInstance();       glob.initialize(args, argv);       MsgQosData    data1(glob);       MsgQosFactory factory(glob);       string        qos   = data1.toXml();       MsgQosData    data2 = factory.readObject(qos);       cout << "data before parsing: " << data1.toXml() << endl;       cout << "data after parsing : " << data2.toXml() << endl;    }    catch(...)  {       cout << "exception occured\n";       return 1;    }   return 0;}#endif/* <qos>    <state id='OK' info='Keep on running"/> <!-- Only for updates and PtP -->    <sender>Tim</sender>    <priority>5</priority>    <subscribe id='__subId:1'/>     <!-- Only for updates, id='__subId:PtP' for point to point messages -->    <rcvTimestamp nanos='1007764305862000002'> <!-- UTC time when message was created in xmlBlaster server with a publish() call, in nanoseconds since 1970 -->          2001-12-07 23:31:45.862000002   <!-- The nanos from above but human readable -->    </rcvTimestamp>    <expiration lifeTime='129595811' forceDestroy='false'/> <!-- Only for persistence layer -->    <queue index='0' of='1'/> <!-- If queued messages are flushed on login -->    <persistent/>    <redeliver>4</redeliver>             <!-- Only for updates -->    <route>       <node id='heron'/>    </route>    <topic readonly='false' destroyDelay='60000' createDomEntry='true'>       <queue relating='topic' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000000' onOverflow='deadMessage'/>       <queue relating='history' type='CACHE' version='1.0' maxEntries='1000' maxBytes='4000000' onOverflow='exception'/>    </topic> </qos> <qos>    <destination queryType='EXACT' forceQueuing='true'>       Tim    </destination>    <destination queryType='EXACT'>       /node/heron/client/Ben    </destination>    <destination queryType='XPATH'>   <!-- Not supported yet -->       //[GROUP='Manager']    </destination>    <destination queryType='XPATH'>   <!-- Not supported yet -->       //ROLE/[@id='Developer']    </destination>    <sender>       Gesa    </sender>    <priority>7</priority>    <route>       <node id='bilbo' stratum='2' timestamp='34460239640' dirtyRead='true'/>    </route> </qos>*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -