1#include <userver/grpc-reflection/reflection_service_component.hpp>
3#include <userver/logging/log.hpp>
4#include <userver/ugrpc/server/server_component.hpp>
5#include <userver/ugrpc/server/service_component_base.hpp>
7#include <grpc-reflection/proto_server_reflection.hpp>
13ReflectionServiceComponent::ReflectionServiceComponent(
18 service_(std::make_unique<grpc_reflection::ProtoServerReflection>()),
19 ugrpc_server_(context.FindComponent<ugrpc::
server::ServerComponent>().GetServer()) {
20 LOG_INFO() <<
"Preparing to register service";
21 RegisterService(*service_);
25ReflectionServiceComponent::~ReflectionServiceComponent() =
default;
27void ReflectionServiceComponent::AddService(std::string_view service) { service_->AddService(service); }
29void ReflectionServiceComponent::OnAllComponentsLoaded() {
30 const auto& service_names = ugrpc_server_.GetServiceNames();
31 service_->AddServiceList(service_names);
36 return ready_.load() ? components::ComponentHealth::kOk : components::ComponentHealth::kFatal;