|
@@ -24,9 +24,9 @@ int32_t TDengine::msgProcess(TAOS_RES* msg)
|
|
const char* dbName = tmq_get_db_name(msg);
|
|
const char* dbName = tmq_get_db_name(msg);
|
|
int32_t vgroupId = tmq_get_vgroup_id(msg);
|
|
int32_t vgroupId = tmq_get_vgroup_id(msg);
|
|
|
|
|
|
- qDebug() << __FILE__ << __LINE__ << "topic: " << topicName;
|
|
|
|
- qDebug() << __FILE__ << __LINE__ << "db: " << dbName;
|
|
|
|
- qDebug() << __FILE__ << __LINE__ << "vgroup id:" << vgroupId;
|
|
|
|
|
|
+ //qDebug() << __FILE__ << __LINE__ << "db: " << dbName;
|
|
|
|
+ //qDebug() << __FILE__ << __LINE__ << "topic: " << topicName;
|
|
|
|
+ //qDebug() << __FILE__ << __LINE__ << "vgroup id:" << vgroupId;
|
|
|
|
|
|
while (1)
|
|
while (1)
|
|
{
|
|
{
|
|
@@ -42,9 +42,11 @@ int32_t TDengine::msgProcess(TAOS_RES* msg)
|
|
taos_print_row(buf, row, fields, numOfFields);
|
|
taos_print_row(buf, row, fields, numOfFields);
|
|
if( g_pSubCB != nullptr )
|
|
if( g_pSubCB != nullptr )
|
|
{
|
|
{
|
|
- g_pSubCB->SubCB((char*)topicName,buf);
|
|
|
|
|
|
+ std::string topic = topicName;
|
|
|
|
+ std::string content = buf;
|
|
|
|
+ g_pSubCB->SubCB((char*)topic.c_str(),(char*)content.c_str());
|
|
}
|
|
}
|
|
- qDebug() << __FILE__ << __LINE__ << "row content: " << buf;
|
|
|
|
|
|
+ //qDebug() << __FILE__ << __LINE__ << "row content: " << buf;
|
|
}
|
|
}
|
|
|
|
|
|
return rows;
|
|
return rows;
|
|
@@ -109,7 +111,7 @@ tmq_t* TDengine::buildConsumer()
|
|
//tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); //禁用提交回调
|
|
//tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); //禁用提交回调
|
|
|
|
|
|
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
|
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
|
- qDebug()<< __FILE__ << __LINE__ << "tmq" << tmq;
|
|
|
|
|
|
+ //qDebug()<< __FILE__ << __LINE__ << "tmq" << tmq;
|
|
tmq_conf_destroy(conf);
|
|
tmq_conf_destroy(conf);
|
|
return tmq;
|
|
return tmq;
|
|
}
|
|
}
|
|
@@ -122,7 +124,8 @@ tmq_list_t* TDengine::buildTopicList()
|
|
std::list<std::string>::iterator itr;
|
|
std::list<std::string>::iterator itr;
|
|
for( itr = g_lstTopics.begin(); itr != g_lstTopics.end(); ++itr )
|
|
for( itr = g_lstTopics.begin(); itr != g_lstTopics.end(); ++itr )
|
|
{
|
|
{
|
|
- int32_t code = tmq_list_append(topicList, itr->c_str());
|
|
|
|
|
|
+ std::string szTopic = *itr;
|
|
|
|
+ int32_t code = tmq_list_append(topicList, szTopic.c_str());
|
|
if (code) {
|
|
if (code) {
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|