10 数据回放之异构回放,c++ api 订阅的一个问题

我参考 Tutorials_CN/stock_market_replay.md at master · dolphindb/Tutorials_CN (github.com) 这篇教程做了异构数据回放的实验,使用文章中的C++例子来订阅:


```

int main(int argc, char *argv[]){
    DBConnection conn;
    string hostName = "127.0.0.1";
    int port = 8848;
    bool ret = conn.connect(hostName, port);

    conn.run("login(\"admin\", \"123456\")");
    DictionarySP t1schema = conn.run("loadTable(\"dfs://snapshotL2\", \"snapshotL2\").schema()");
    DictionarySP t2schema = conn.run("loadTable(\"dfs://trade\", \"trade\").schema()");
    DictionarySP t3schema = conn.run("loadTable(\"dfs://order\", \"order\").schema()");

    unordered_map<string, DictionarySP> sym2schema;
    sym2schema["snapshot"] = t1schema;
    sym2schema["trade"] = t2schema;
    sym2schema["order"] = t3schema;
    StreamDeserializerSP sdsp = new StreamDeserializer(sym2schema);
    auto myHandler = [&](Message msg) {
            const string &symbol = msg.getSymbol();
            cout << symbol << ":";
            size_t len = msg->size();
            for (int i = 0; i < len; i++) {
                    cout <<msg->get(i)->getString() << ",";
            }
            cout << endl;
    };

    int listenport = 10260;
    ThreadedClient threadedClient(listenport);
    auto thread = threadedClient.subscribe(hostName, port, myHandler, "messageStream", "printMessageStream", -1, true, nullptr, false, false, sdsp);
    cout<<"Successed to subscribe messageStream"<<endl;
    thread->join();

    return 0;
}

```


但是我在所有的头文件中均没有找到 StreamDeserializer 的相关定义,我使用的是 release 200 的c++api, 在 ThreadedClient 的 subscribe 函数中也为找到接收 sdsp的参数,我想问一下,现在版本的api如何对 Blob 类型 MsgBody 进行反序列化?

请先 登录 后评论

1 个回答

wale

c++ api版本正在测试,预计下周发布,敬请期待。

请先 登录 后评论