本文整理汇总了C++中Message_ptr::getBody方法的典型用法代码示例。如果您正苦于以下问题:C++ Message_ptr::getBody方法的具体用法?C++ Message_ptr::getBody怎么用?C++ Message_ptr::getBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message_ptr
的用法示例。
在下文中一共展示了Message_ptr::getBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendKernelImpl
SendResult_ptr DefaultMQProducerImpl::sendKernelImpl(Message_ptr msg, MessageQueue* mq, std::string& communicationMode, bool sendCallback) {
std::string brokerAddr = this->mQClientFactory->findBrokerAddressInPublish(mq->getBrokerName());
if (brokerAddr.empty()) {
// TODO 此处可能对Name Server压力过大,需要调优
this->mQClientFactory->updateTopicRouteInfoFromNameServer(mq->getTopic());
this->mQClientFactory->updateTopicRouteInfoFromNameServer(mq->getTopic(), true, this->defaultMQProducer);
brokerAddr = this->mQClientFactory->findBrokerAddressInPublish(mq->getBrokerName());
}
if (!brokerAddr.empty()) {
std::string prevBody = msg->getBody();
int sysFlag = 0;
SendMessageRequestHeader_var requestHeader = new SendMessageRequestHeader();
requestHeader->setProducerGroup(this->defaultMQProducer->getProducerGroup());
requestHeader->setTopic(msg->getTopic());
requestHeader->setDefaultTopic(this->defaultMQProducer->getCreateTopicKey());
requestHeader->setDefaultTopicQueueNums(this->defaultMQProducer->getDefaultTopicQueueNums());
requestHeader->setQueueId(mq->getQueueId());
requestHeader->setSysFlag(sysFlag);
requestHeader->setBornTimestamp(112233);
requestHeader->setFlag(msg->getFlag());
SendResult_var sendResult = new SendResult();
this->mQClientFactory->getMQClientAPIImpl()->sendMessage(brokerAddr, mq->getBrokerName(), SendMessageRequestHeader_var::Duplicate(requestHeader), 3);
return SendResult_var::Duplicate(sendResult);
}
return NULL;
}