ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
server_reactor.cpp
#include <rpp/rpp.hpp>
#include <grpc++/create_channel.h>
#include <rppgrpc/rppgrpc.hpp>
#include "protocol.grpc.pb.h"
class server : public TestService::CallbackService
{
grpc::ServerReadReactor<Request>* ClientSide(grpc::CallbackServerContext* /*context*/, Response* /*response*/) override
{
const auto reactor = new rppgrpc::server_read_reactor<Request>();
reactor->get_observable().subscribe([](const Request&) {}, []() { std::cout << "DONE" << std::endl; });
return reactor;
}
grpc::ServerBidiReactor<Request, Response>* Bidirectional(grpc::CallbackServerContext* /*context*/) override
{
reactor->get_observable().subscribe([](const Request&) {}, []() { std::cout << "DONE" << std::endl; });
reactor->get_observer().on_next(Response{});
return reactor;
}
grpc::ServerWriteReactor<Response>* ServerSide(grpc::CallbackServerContext* /*context*/, const Request* /*request*/) override
{
const auto reactor = new rppgrpc::server_write_reactor<Response>();
reactor->get_observable().subscribe([](rpp::utils::none) {}, []() { std::cout << "DONE" << std::endl; });
reactor->get_observer().on_next(Response{});
return reactor;
}
};
int main()
{
return 0;
}
RPP's based implementation for grpc server bidirectional reactor.
Definition server_reactor.hpp:40
RPP's based implementation for grpc server read reactor.
Definition server_reactor.hpp:185
RPP's based implementation for grpc server write reactor.
Definition server_reactor.hpp:118
Definition server_reactor.cpp:13
Definition utils.hpp:25