Beispiel #1
0
    void on_link_close(proton::event &e) {
        proton::link lnk = e.link();

        if (!!lnk.sender()) {
            unsubscribe(lnk.sender());
        }
    }
Beispiel #2
0
    void on_sendable(proton::event &e) {
        proton::link lnk = e.link();
        std::string address = lnk.local_source().address();
        proton::sender s = lnk.sender();

        queues_.get(address).dispatch(&s);
    }
Beispiel #3
0
 void on_link_opening(proton::event &e) {
     proton::link& lnk = e.link();
     if (lnk.is_sender()) {
         proton::sender &sender(lnk.sender());
         proton::terminus &remote_source(lnk.remote_source());
         if (remote_source.is_dynamic()) {
             std::string address = queue_name();
             lnk.source().address(address);
             queue *q = new queue(true);
             queues[address] = q;
             q->subscribe(sender);
             std::cout << "broker dynamic outgoing link from " << address << std::endl;
         }
         else {
             std::string address = remote_source.address();
             if (!address.empty()) {
                 lnk.source().address(address);
                 get_queue(address).subscribe(sender);
                 std::cout << "broker outgoing link from " << address << std::endl;
             }
         }
     }
     else {
         std::string address = lnk.remote_target().address();
         if (!address.empty())
             lnk.target().address(address);
         std::cout << "broker incoming link to " << address << std::endl;
     }
 }
Beispiel #4
0
    void on_link_open(proton::event &e) {
        proton::link lnk = e.link();

        if (!!lnk.sender()) {
            proton::terminus remote_source(lnk.remote_source());
            queue &q = remote_source.dynamic() ?
                queues_.dynamic() : queues_.get(remote_source.address());
            lnk.local_source().address(q.name());

            q.subscribe(lnk.sender());
            std::cout << "broker outgoing link from " << q.name() << std::endl;
        } else {
            // Receiver
            std::string address = lnk.remote_target().address();
            if (!address.empty()) {
                lnk.local_target().address(address);
                std::cout << "broker incoming link to " << address << std::endl;
            }
        }
    }
Beispiel #5
0
 void on_message(proton::event &e) {
     std::string address = e.link().local_target().address();
     
     queues_.get(address).publish(e.message(), e.link().receiver());
 }
 void on_link_open(proton::event &e) {
     if (e.link() == receiver)
         send_request();
 }
Beispiel #7
0
 void on_link_opened(proton::event &e) {
     if (&e.link() == receiver.get())
         send_request();
 }
Beispiel #8
0
 void on_message(proton::event &e) {
     std::string addr = e.link().target().address();
     get_queue(addr).publish(e.message());
 }
Beispiel #9
0
 void on_sendable(proton::event &e) {
     proton::link& lnk = e.link();
     std::string addr = lnk.source().address();
     proton::sender &s(lnk.sender());
     get_queue(addr).dispatch(&s);
 }
Beispiel #10
0
 void on_link_closing(proton::event &e) {
     proton::link &lnk = e.link();
     if (lnk.is_sender()) {
         unsubscribe(lnk.sender());
     }
 }