本文整理汇总了C++中TibrvMsg::convertToString方法的典型用法代码示例。如果您正苦于以下问题:C++ TibrvMsg::convertToString方法的具体用法?C++ TibrvMsg::convertToString怎么用?C++ TibrvMsg::convertToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TibrvMsg
的用法示例。
在下文中一共展示了TibrvMsg::convertToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMsg
void onMsg(TibrvListener* listener, TibrvMsg& msg)
{
const char* msgString = NULL;
// Convert the incoming message to a string
msg.convertToString(msgString);
// Report we are processing the message
printf("Processing message %s\n",msgString);
fflush(stdout);
// Imitate delay of one second
waitQueue.timedDispatch((tibrv_f64)1.0);
/* Increase count of processed messages. In real world
* access to this variable should be guarded
* because we may be changing it from multiple
* dispatcher threads at the same time.
*/
processedMessageCount++;
/* If we have processed all messages then report it
* and create a timer on the trigger queue so the
* dispatch call on that queue returns.
*/
if (processedMessageCount == TOTAL_MESSAGES)
{
/* we don't need to keep the timer here */
TibrvTimer* timer = new TibrvTimer();
timer->create(&triggerQueue,
new TimerCallback(),
(tibrv_f64)0, /* no delay */
NULL);
}
}
示例2: onMsg
void onMsg(TibrvListener* listener, TibrvMsg& msg)
{
const char* sendSubject = NULL;
const char* msgString = NULL;
// Get the subject name to which this message was sent
msg.getSendSubject(sendSubject);
// Convert the incoming message to a string
msg.convertToString(msgString);
printf("Received message on subject %s: %s\n",
sendSubject, msgString);
fflush(stdout);
}