Qpid质子on_sendable只被调用一次

qpid proton on_sendable is called just once

本文关键字:一次 调用 on 质子 sendable Qpid      更新时间:2023-10-16

我正在用c++实现Qpid质子客户端。

Qpid版本为0.12.2。

我运行默认容器:

proton::container(myHandler).run();

MyHandler像这样:

void MyHandler::on_start(proton::event& e) {
proton::connection conn = e.container().connect(url);
_senderEvent            = conn.open_sender(EVENT_RECEPTION);
}
void MyHandler::on_message(proton::event &e) {
}
void MyHandler::on_link_open(proton::event &e) {
    std::cout << "LINK OPEN " << std::endl;
}
void MyHandler::on_connection_open(proton::event &e) {
}
void MyHandler::on_sendable(proton::event &e) {
    std::cout << "on sendable! " << std::endl;
}

一切正常!它连接,创建发送者等。

但是,on_sendable只被调用一次!虽然我不关闭它,它永远不会返回调用on_sendable

原因是什么?

谢谢。

你可能已经自己找到了这个问题的答案,但据我所知,on_sendable将在你打开发送器后被调用,然后每次在你通过质子发送消息后被调用。如果你从不发送消息,那么on_sendable只会被调用一次。