ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
rppgrpc::server_bidi_reactor< Request, Response > Class Template Referencefinal

RPP's based implementation for grpc server bidirectional reactor. More...

#include <server_reactor.hpp>

Detailed Description

template<rpp::constraint::decayed_type Request, rpp::constraint::decayed_type Response>
class rppgrpc::server_bidi_reactor< Request, Response >

RPP's based implementation for grpc server bidirectional reactor.

To use it you need:

  • create it via new operator
  • return it from bidirection method of CallbackService interface
  • to access values FROM stream you can subscribe to observable obtained via reactor->get_observable() (same observable WOULD emit on_completed in case of successful stream termination and on_error in case of some errors with grpc stream)
  • to pass values TO stream you can emit values to observer obtained via reactor->get_observer()
Warning
grpc server reactor have to finish manually, so it is expected that you call on_completed() on reactor->get_observer()
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;
}
Examples
server_reactor.cpp.

The documentation for this class was generated from the following files: