userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
client_factory_component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/client/client_factory_component.hpp
4
/// @brief @copybrief ugrpc::client::ClientFactoryComponent
5
6
#
include
<
userver
/
components
/
component_base
.
hpp
>
7
#
include
<
userver
/
middlewares
/
runner
.
hpp
>
8
9
#
include
<
userver
/
ugrpc
/
client
/
client_factory
.
hpp
>
10
#
include
<
userver
/
ugrpc
/
client
/
middlewares
/
base
.
hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
ugrpc::client {
15
16
namespace
impl {
17
18
/// @brief The interface for a `ClientFactoryComponent` component. So, `ClientFactoryComponent` runs with middlewares.
19
using
MiddlewareRunnerComponentBase = USERVER_NAMESPACE::middlewares::
RunnerComponentBase
<
MiddlewareBase
, ClientInfo>;
20
21
}
// namespace impl
22
23
/// @ingroup userver_components
24
///
25
/// @brief Provides a ClientFactory in the component system
26
///
27
/// Multiple ClientFactoryComponent instances may be created if different
28
/// parameters are required for different clients.
29
///
30
/// Requires ugrpc::client::CommonComponent.
31
///
32
/// ## Authentication
33
/// Authentication is controlled by `auth-type` static config field.
34
/// Possible values:
35
/// - `insecure` (`InsecureChannelCredentials` - default)
36
/// - `ssl` (`SslCredentials`)
37
///
38
/// Default (system) authentication keys are used regardless of the chosen
39
/// auth-type.
40
///
41
/// ## Service config
42
/// As per https://github.com/grpc/grpc/blob/master/doc/service_config.md
43
/// service config should be distributed via the name resolution process.
44
/// We allow setting default service_config: pass desired JSON literal to `default-service-config` parameter
45
///
46
/// ## Static options of ugrpc::client::ClientFactoryComponent :
47
/// @include{doc} scripts/docs/en/components_schema/grpc/src/ugrpc/client/client_factory_component.md
48
///
49
/// Options inherited from @ref middlewares::RunnerComponentBase :
50
/// @include{doc} scripts/docs/en/components_schema/core/src/middlewares/runner_component_base.md
51
///
52
/// Options inherited from @ref components::ComponentBase :
53
/// @include{doc} scripts/docs/en/components_schema/core/src/components/impl/component_base.md
54
///
55
/// The default component name for static config is `"grpc-client-factory"`.
56
///
57
/// @see https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
58
class
ClientFactoryComponent
final
:
public
impl::MiddlewareRunnerComponentBase {
59
public
:
60
/// @ingroup userver_component_names
61
/// @brief The default name of ugrpc::client::middlewares::log::Component
62
static
constexpr
std::string_view
kName
=
"grpc-client-factory"
;
63
64
ClientFactoryComponent(
const
components
::ComponentConfig& config,
const
components
::ComponentContext& context);
65
66
ClientFactory& GetFactory();
67
68
static
yaml_config::Schema GetStaticConfigSchema();
69
70
private
:
71
std::optional<ClientFactory> factory_;
72
};
73
74
}
// namespace ugrpc::client
75
76
template
<>
77
inline
constexpr
bool
components
::kHasValidate<ugrpc::client::ClientFactoryComponent> =
true
;
78
79
USERVER_NAMESPACE_END
userver
ugrpc
client
client_factory_component.hpp
Generated on
for userver by
Doxygen
1.17.0