Esempio n. 1
0
 // A receiver receives messages from a publisher to a queue.
 void on_receiver_open(proton::receiver &receiver) override {
     std::string qname = receiver.target().address();
     if (qname == "shutdown") {
         std::cout << "broker shutting down" << std::endl;
         // Sending to the special "shutdown" queue stops the broker.
         proton::controller::get(receiver.connection()).stop(
             proton::error_condition("shutdown", "stop broker"));
     } else {
         std::cout << "receiving to " << qname << std::endl;
     }
 }
Esempio n. 2
0
    void send_request() {
        proton::message req;
        req.body(requests.front());
        req.reply_to(receiver.remote_source().address());

        sender.send(req);
    }
 // called via work_queue
 void receive_done() {
     // Add 1 credit, a receiver has taken a message out of the buffer.
     receiver_.add_credit(1);
 }
 void on_receiver_open(proton::receiver& r) override {
     receiver_ = r;
     std::lock_guard<std::mutex> l(lock_);
     work_queue_ = &receiver_.work_queue();
     receiver_.add_credit(MAX_BUFFER); // Buffer is empty, initial credit is the limit
 }
 void on_receiver_open(proton::receiver& r) override {
     std::cout << r << ": New incoming receiver: target address: " << r.target().address() << "\n";
 }