示例#1
0
 void on_connection_open(proton::event &e, proton::connection &c) override {
     std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
         c.transport().ssl().protocol() << std::endl;
     if (c.transport().sasl().outcome() == sasl::OK) {
         std::string subject = c.transport().ssl().remote_subject();
         std::cout << "Inbound client certificate identity " << find_CN(subject) << std::endl;
     }
     else {
         std::cout << "Inbound client authentication failed" <<std::endl;
         c.close();
     }
     inbound_listener.close();
 }
示例#2
0
 void remove_stale_consumers(proton::connection connection) {
     proton::link_range r = connection.find_links(proton::endpoint::REMOTE_ACTIVE);
     
     for (proton::link_iterator l = r.begin(); l != r.end(); ++l) {
         if (!!l->sender()) {
             unsubscribe(l->sender());
         }
     }
 }
示例#3
0
 void remove_stale_consumers(proton::connection &connection) {
     proton::link *l = connection.link_head(proton::endpoint::REMOTE_ACTIVE);
     while (l) {
         if (l->is_sender()) {
             unsubscribe(l->sender());
         }
         l = l->next(proton::endpoint::REMOTE_ACTIVE);
     }
 }
示例#4
0
 void on_connection_open(proton::connection& c) override {
     // Create the has_messages callback for use with queue subscriptions.
     //
     // Note the captured and bound arguments must be thread-safe to copy,
     // shared_ptr<work_queue>, and plain pointers this and q are all safe.
     //
     // The proton::connection object c is not thread-safe to copy.
     // However when the work_queue calls this->has_messages it will be safe
     // to use any proton objects associated with c again.
     auto work = proton::work_queue::get(c);
     has_messages_callback_ = [this, work](queue* q) {
         work->push(std::bind(&broker_connection_handler::has_messages, this, q));
     };
     c.open();               // Always accept
 }
示例#5
0
    void on_message(proton::event &e) {
        std::cout << "Received " << e.message().body() << std::endl;

        std::string reply_to = e.message().reply_to();
        proton::message reply;

        reply.address(reply_to);
        reply.body(to_upper(e.message().body().get<std::string>()));
        reply.correlation_id(e.message().correlation_id());

        if (!senders[reply_to]) {
            senders[reply_to] = connection.open_sender(reply_to);
        }

        senders[reply_to].send(reply);
    }
示例#6
0
 void on_connection_open(proton::event &e, proton::connection &c) override {
     std::string subject = c.transport().ssl().remote_subject();
     std::cout << "Outgoing client connection connected via SSL.  Server certificate identity " <<
         find_CN(subject) << std::endl;
 }
示例#7
0
 void on_connection_open(proton::connection &c) override {
     c.open_sender(url.path());
 }
 void on_connection_open(proton::connection &c) override {
     std::cout << "unexpected connection event on main handler" << std::endl;
     c.close();
 }
 void on_connection_open(proton::connection &c) override {
     std::cout << "connection events going to handler_2" << std::endl;
     std::cout << "connection max_frame_size: " << c.transport().max_frame_size() <<
         ", idle timeout: " << c.transport().idle_timeout() << std::endl;
     c.close();
 }
示例#10
0
    void on_start(proton::event &e) {
        connection = e.container().connect(url);
        connection.open_receiver(url.path());

        std::cout << "server connected to " << url << std::endl;
    }
    void on_connection_open(proton::connection& c) override {
        std::cout << c << ": New incoming connection to " << c.virtual_host() << " from: "
		  << c.user() << "\n";
    }
示例#12
0
 void on_connection_open(proton::event &e, proton::connection &c) override {
     sender = c.open_sender(url.path());
     receiver = c.open_receiver("", proton::link_options().dynamic_address(true));
 }
示例#13
0
 void on_connection_open(proton::connection &c) override {
     std::cout << "Inbound server connection connected via SSL.  Protocol: " <<
         c.transport().ssl().protocol() << std::endl;
     acceptor.close();
 }