ZeroMQ Majordomo工作人员的断言错误

时间:2015-09-07 15:26:26

标签: c++ zeromq domo

我遇到了ZeroMQ Majordomo工作者API的问题,该问题使用这个简单的工作者客户端在断言上失败。

我正在使用的经纪人来自ZeroMQ网站的示例部分。 C:\Users\[yourUser]\Documents\WindowsPowerShell\modules 的用途是什么以及何时设置?

m_reply_to

这是工作人员代码。

mdwrkapi.hpp:123: zmsg* mdwrk::recv(zmsg*&): Assertion `m_reply_to.size()!=0' failed.

这是客户端部分:

  mdwrk session ("tcp://localhost:5555", "GenericData", verbose);

zmsg *reply = 0;
    while (1) {
        zmsg *request = session.recv (reply);
        if (request == 0) {
            break;              //  Worker was interrupted
        }
        reply = request;        //  Echo is complex… :-)
    }

1 个答案:

答案 0 :(得分:1)

m_reply_to 用于什么?

根据Majordomo源代码, m_reply_to 声明为:

/*  =====================================================================
mdwrkapi.hpp

Majordomo Protocol Worker API
Implements the MDP/Worker spec at http://rfc.zeromq.org/spec:7.

---------------------------------------------------------------------
Copyright (c) 1991-2011 iMatix Corporation <www.imatix.com>
...
*/
...
private:
    ...
    //  Return address, if any
    std::string m_reply_to;  // <<------------------------- RETURN ADDRESS

用于存储recv()中的返回地址:

                //  We should pop and save as many addresses as there are
                //  up to a null part, but for now, just save one...
                m_reply_to = msg->unwrap ();

何时设置?

从源代码中可以看出,它可能发生在recv()

//  ---------------------------------------------------------------------
//  Send reply, if any, to broker and wait for next request.

zmsg *
recv (zmsg *&reply_p)
{
    //  Format and send the reply if we were provided one
    zmsg *reply = reply_p;
    assert (reply || !m_expect_reply);
    if (reply) {
        assert (m_reply_to.size()!=0);
        ...