Пример #1
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();
     }
 }
Пример #2
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();
     }
 }
Пример #3
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();
     }
 }
Пример #4
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();
        }
    }
Пример #5
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();
     }
 }
Пример #6
0
 void on_delivery_accept(proton::event &e, proton::delivery &d) override {
     // All done.
     d.connection().close();
 }
Пример #7
0
 // A message is received.
 void on_message(proton::delivery &d, proton::message &m) override {
     std::string qname = d.receiver().target().address();
     queues_.get(qname)->push(m);
 }