示例#1
0
 void on_delivery_accept(proton::event &e, proton::delivery &d) override {
     confirmed++;
     if (confirmed == total) {
         std::cout << "all messages confirmed" << std::endl;
         d.connection().close();
     }
 }
示例#2
0
 void on_message(proton::event &e, proton::delivery &d, proton::message &response) override {
     if (requests.empty()) return; // Spurious extra message!
     std::cout << requests.front() << " => " << response.body() << std::endl;
     requests.erase(requests.begin());
     if (!requests.empty()) {
         send_request();
     } else {
         d.connection().close();
     }
 }
示例#3
0
 void on_message(proton::delivery &d, proton::message &msg) override {
     if (msg.id().get<uint64_t>() < received)
         return; // ignore duplicate
     if (expected == 0 || received < expected) {
         std::cout << msg.body() << std::endl;
         received++;
     }
     if (received == expected) {
         d.receiver().close();
         d.connection().close();
     }
 }
示例#4
0
 void on_message(proton::delivery &d, proton::message &msg) override {
     received_content_ = proton::get<proton::binary>(msg.body());
     received_bytes_ += received_content_.size();
     if (received_ < total_) {
         received_++;
     }
     d.settle();
     if (received_ == total_) {
         d.receiver().close();
         d.connection().close();
     }
 }
示例#5
0
    void on_message(proton::delivery &d, proton::message &msg) override {
        if (proton::coerce<uint64_t>(msg.id()) < received) {
            return; // Ignore duplicate
        }

        if (expected == 0 || received < expected) {
            std::cout << msg.body() << std::endl;
            received++;
        }

        if (received == expected) {
            d.receiver().close();
            d.connection().close();

            if (!!acceptor) acceptor.close();
        }
    }
示例#6
0
 void on_delivery_accept(proton::event &e, proton::delivery &d) override {
     // All done.
     d.connection().close();
 }