Exemplo n.º 1
0
descriptor connect(const proton::url& u) {
    // convert "0.0.0.0" to "127.0.0.1" on Windows for outgoing sockets
    std::string host = (u.host() == "0.0.0.0") ? "127.0.0.1" : u.host();
    descriptor fd = INVALID_SOCKET;
    try{
        auto_addrinfo addr;
        gai_check(::getaddrinfo(host.empty() ? 0 : host.c_str(),
                                amqp_service(u.port().empty() ? 0 : u.port().c_str()),
                                0, &addr.ptr),
                  "connect address invalid: ");
        fd = check(::socket(addr->ai_family, SOCK_STREAM, 0), "connect socket: ");
        check(::connect(fd, addr->ai_addr, addr->ai_addrlen), "connect: ");
        return fd;
    } catch (...) {
        if (fd != INVALID_SOCKET) ::closesocket(fd);
        throw;
    }
}
Exemplo n.º 2
0
 void on_container_start(proton::container &c) override {
     proton::source_options opts;
     set_filter(opts, "colour = 'green'");
     proton::connection conn = c.connect(url);
     conn.open_receiver(url.path(), proton::receiver_options().source(opts));
 }
Exemplo n.º 3
0
 void on_connection_open(proton::connection &c) override {
     c.open_sender(url.path());
 }
Exemplo n.º 4
0
 void 
 on_start(proton::event &e) 
 {
   log ( "on_start listening on |%s|", url.str().c_str() );
   receiver = e.container().open_receiver(url);
 }
Exemplo n.º 5
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;
    }
Exemplo n.º 6
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));
 }
Exemplo n.º 7
0
 void on_start(proton::event &e) {
     e.connection().open();
     e.connection().open_receiver(url.path());
     std::cout << "server connected to " << url << std::endl;
 }
Exemplo n.º 8
0
 void on_start(proton::event &e) {
     proton::connection conn = e.container().connect(url);
     conn.open_receiver(url.path());
     conn.open_sender(url.path());
 }
Exemplo n.º 9
0
 void on_start(proton::event &e) {
     e.connection().open();
     sender = e.connection().open_sender(url.path());
     receiver = e.connection().open_receiver("", proton::link_options().dynamic_address(true));
 }