ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
client_reactor.cpp
#include <rpp/rpp.hpp>
#include <grpc++/create_channel.h>
#include <rppgrpc/rppgrpc.hpp>
#include "protocol.grpc.pb.h"
int main() // NOLINT(bugprone-exception-escape)
{
{
auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials());
auto stub = TestService::NewStub(channel);
grpc::ClientContext ctx{};
stub->async()->Bidirectional(&ctx, reactor);
reactor->get_observable().subscribe([](const Response&) {});
reactor->init();
reactor->get_observer().on_next(Request{});
}
{
auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials());
auto stub = TestService::NewStub(channel);
grpc::ClientContext ctx{};
const auto reactor = new rppgrpc::client_read_reactor<Response>();
Request req{};
stub->async()->ServerSide(&ctx, &req, reactor);
reactor->get_observable().subscribe([](const Response&) {});
reactor->init();
}
{
auto channel = grpc::CreateChannel("localhost:50051", grpc::InsecureChannelCredentials());
auto stub = TestService::NewStub(channel);
grpc::ClientContext ctx{};
const auto reactor = new rppgrpc::client_write_reactor<Request>();
Response resp{};
stub->async()->ClientSide(&ctx, &resp, reactor);
reactor->get_observable().subscribe([](const rpp::utils::none&) {});
reactor->init();
reactor->get_observer().on_next(Request{});
}
return 0;
}
RPP's based implementation for grpc client bidirectional reactor.
Definition fwd.hpp:38
RPP's based implementation for grpc client read reactor.
Definition fwd.hpp:44
RPP's based implementation for grpc client write reactor.
Definition fwd.hpp:41
Definition utils.hpp:25