Example #1
0
 reactor_send(const std::string &url, int c, int size, bool replying)
     : url_(url), sent_(0), confirmed_(0), total_(c),
       received_(0), received_bytes_(0), replying_(replying) {
     if (replying_)
         message_.reply_to("localhost/test");
     proton::binary content;
     content.assign((size_t) size, 'X');
     message_.body(content);
 }
Example #2
0
    void on_message(proton::delivery &d, proton::message &m) override {
        std::cout << "Received " << m.body() << std::endl;

        std::string reply_to = m.reply_to();
        sender_map::iterator it = senders.find(reply_to);

        if (it == senders.end()) {
            std::cout << "No link for reply_to: " << reply_to << std::endl;
        } else {
            proton::sender sender = it->second;
            proton::message reply;

            reply.to(reply_to);
            reply.body(to_upper(proton::get<std::string>(m.body())));
            reply.correlation_id(m.correlation_id());

            sender.send(reply);
        }
    }