| 9 | **/ |
| 10 | |
| 11 | int main() // NOLINT(bugprone-exception-escape) |
| 12 | { |
| 13 | { |
| 14 | //! [bidi_reactor] |
| 15 | auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials()); |
| 16 | auto stub = TestService::NewStub(channel); |
| 17 | |
| 18 | grpc::ClientContext ctx{}; |
| 19 | const auto reactor = new rppgrpc::client_bidi_reactor<Request, Response>(); |
| 20 | stub->async()->Bidirectional(&ctx, reactor); |
| 21 | reactor->get_observable().subscribe([](const Response&) {}); |
| 22 | |
| 23 | reactor->init(); |
| 24 | |
| 25 | reactor->get_observer().on_next(Request{}); |
| 26 | //! [bidi_reactor] |
| 27 | } |
| 28 | { |
| 29 | //! [read_reactor] |
| 30 | auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials()); |
| 31 | auto stub = TestService::NewStub(channel); |
| 32 | |
| 33 | grpc::ClientContext ctx{}; |
| 34 | const auto reactor = new rppgrpc::client_read_reactor<Response>(); |
| 35 | Request req{}; |
| 36 | stub->async()->ServerSide(&ctx, &req, reactor); |
| 37 | reactor->get_observable().subscribe([](const Response&) {}); |
| 38 | |
| 39 | reactor->init(); |
| 40 | //! [read_reactor] |
| 41 | } |
| 42 | { |
| 43 | //! [write_reactor] |
| 44 | auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials()); |
| 45 | auto stub = TestService::NewStub(channel); |
| 46 | |
| 47 | grpc::ClientContext ctx{}; |
| 48 | const auto reactor = new rppgrpc::client_write_reactor<Request>(); |
| 49 | Response resp{}; |
| 50 | stub->async()->ClientSide(&ctx, &resp, reactor); |
| 51 | reactor->get_observable().subscribe([](const rpp::utils::none&) {}); |
| 52 | |
| 53 | reactor->init(); |
| 54 | |
| 55 | reactor->get_observer().on_next(Request{}); |
| 56 | //! [write_reactor] |
| 57 | } |
| 58 | |
| 59 | return 0; |
| 60 | } |
nothing calls this directly
no test coverage detected